📄 unistd.h
字号:
# define pwrite pwrite64# endif# endif# ifdef __USE_LARGEFILE64/* Read NBYTES into BUF from FD at the given position OFFSET without changing the file pointer. Return the number read, -1 for errors or 0 for EOF. */extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) __THROW;/* Write N bytes of BUF to FD at the given position OFFSET without changing the file pointer. Return the number written, or -1. */extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n, __off64_t __offset) __THROW;# endif#endif/* Create a one-way communication channel (pipe). If successful, two file descriptors are stored in PIPEDES; bytes written on PIPEDES[1] can be read from PIPEDES[0]. Returns 0 if successful, -1 if not. */extern int pipe (int __pipedes[2]) __THROW;/* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. If SECONDS is zero, any currently scheduled alarm will be cancelled. The function returns the number of seconds remaining until the last alarm scheduled would have signaled, or zero if there wasn't one. There is no return value to indicate an error, but you can set `errno' to 0 and check its value after calling `alarm', and this might tell you. The signal may come late due to processor scheduling. */extern unsigned int alarm (unsigned int __seconds) __THROW;/* Make the process sleep for SECONDS seconds, or until a signal arrives and is not ignored. The function returns the number of seconds less than SECONDS which it actually slept (thus zero if it slept the full time). If a signal handler does a `longjmp' or modifies the handling of the SIGALRM signal while inside `sleep' call, the handling of the SIGALRM signal afterwards is undefined. There is no return value to indicate error, but if `sleep' returns SECONDS, it probably didn't work. */extern unsigned int sleep (unsigned int __seconds) __THROW;#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED/* Set an alarm to go off (generating a SIGALRM signal) in VALUE microseconds. If INTERVAL is nonzero, when the alarm goes off, the timer is reset to go off every INTERVAL microseconds thereafter. Returns the number of microseconds remaining before the alarm. */extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) __THROW;/* Sleep USECONDS microseconds, or until a signal arrives that is not blocked or ignored. */extern int usleep (__useconds_t __useconds) __THROW;#endif/* Suspend the process until a signal arrives. This always returns -1 and sets `errno' to EINTR. */extern int pause (void) __THROW;/* Change the owner and group of FILE. */extern int chown (__const char *__file, __uid_t __owner, __gid_t __group) __THROW;#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED/* Change the owner and group of the file that FD is open on. */extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW;/* Change owner and group of FILE, if it is a symbolic link the ownership of the symbolic link is changed. */extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group) __THROW;#endif /* Use BSD || X/Open Unix. *//* Change the process's working directory to PATH. */extern int chdir (__const char *__path) __THROW;#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED/* Change the process's working directory to the one FD is open on. */extern int fchdir (int __fd) __THROW;#endif/* Get the pathname of the current working directory, and put it in SIZE bytes of BUF. Returns NULL if the directory couldn't be determined or SIZE was too small. If successful, returns BUF. In GNU, if BUF is NULL, an array is allocated with `malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as necessary. */extern char *getcwd (char *__buf, size_t __size) __THROW;#ifdef __USE_GNU/* Return a malloc'd string containing the current directory name. If the environment variable `PWD' is set, and its value is correct, that value is used. */extern char *get_current_dir_name (void) __THROW;#endif#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED/* Put the absolute pathname of the current working directory in BUF. If successful, return BUF. If not, put an error message in BUF and return NULL. BUF should be at least PATH_MAX bytes long. */extern char *getwd (char *__buf) __THROW;#endif/* Duplicate FD, returning a new file descriptor on the same file. */extern int dup (int __fd) __THROW;/* Duplicate FD to FD2, closing FD2 and making it open on the same file. */extern int dup2 (int __fd, int __fd2) __THROW;/* NULL-terminated array of "NAME=VALUE" environment variables. */extern char **__environ;#ifdef __USE_GNUextern char **environ;#endif/* Replace the current process, executing PATH with arguments ARGV and environment ENVP. ARGV and ENVP are terminated by NULL pointers. */extern int execve (__const char *__path, char *__const __argv[], char *__const __envp[]) __THROW;#ifdef __USE_GNU/* Execute the file FD refers to, overlaying the running program image. ARGV and ENVP are passed to the new program, as for `execve'. */extern int fexecve (int __fd, char *__const __argv[], char *__const __envp[]) __THROW;#endif/* Execute PATH with arguments ARGV and environment from `environ'. */extern int execv (__const char *__path, char *__const __argv[]) __THROW;/* Execute PATH with all arguments after PATH until a NULL pointer, and the argument after that for environment. */extern int execle (__const char *__path, __const char *__arg, ...) __THROW;/* Execute PATH with all arguments after PATH until a NULL pointer and environment from `environ'. */extern int execl (__const char *__path, __const char *__arg, ...) __THROW;/* Execute FILE, searching in the `PATH' environment variable if it contains no slashes, with arguments ARGV and environment from `environ'. */extern int execvp (__const char *__file, char *__const __argv[]) __THROW;/* Execute FILE, searching in the `PATH' environment variable if it contains no slashes, with all arguments after FILE until a NULL pointer and environment from `environ'. */extern int execlp (__const char *__file, __const char *__arg, ...) __THROW;#if defined __USE_MISC || defined __USE_XOPEN/* Add INC to priority of the current process. */extern int nice (int __inc) __THROW;#endif/* Terminate program execution with the low-order 8 bits of STATUS. */extern void _exit (int __status) __attribute__ ((__noreturn__));/* Get the `_PC_*' symbols for the NAME argument to `pathconf' and `fpathconf'; the `_SC_*' symbols for the NAME argument to `sysconf'; and the `_CS_*' symbols for the NAME argument to `confstr'. */#include <bits/confname.h>/* Get file-specific configuration information about PATH. */extern long int pathconf (__const char *__path, int __name) __THROW;/* Get file-specific configuration about descriptor FD. */extern long int fpathconf (int __fd, int __name) __THROW;/* Get the value of the system variable NAME. */extern long int sysconf (int __name) __THROW __attribute__ ((__const__));#ifdef __USE_POSIX2/* Get the value of the string-valued system variable NAME. */extern size_t confstr (int __name, char *__buf, size_t __len) __THROW;#endif/* Get the process ID of the calling process. */extern __pid_t getpid (void) __THROW;/* Get the process ID of the calling process's parent. */extern __pid_t getppid (void) __THROW;/* Get the process group ID of the calling process. This function is different on old BSD. */#ifndef __FAVOR_BSDextern __pid_t getpgrp (void) __THROW;#else# ifdef __REDIRECTextern __pid_t __REDIRECT (getpgrp, (__pid_t __pid) __THROW, __getpgid);# else# define getpgrp __getpgid# endif#endif/* Get the process group ID of process PID. */extern __pid_t __getpgid (__pid_t __pid) __THROW;#ifdef __USE_XOPEN_EXTENDEDextern __pid_t getpgid (__pid_t __pid) __THROW;#endif/* Set the process group ID of the process matching PID to PGID. If PID is zero, the current process's process group ID is set. If PGID is zero, the process ID of the process is used. */extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW;#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED/* Both System V and BSD have `setpgrp' functions, but with different calling conventions. The BSD function is the same as POSIX.1 `setpgid' (above). The System V function takes no arguments and puts the calling process in its on group like `setpgid (0, 0)'. New programs should always use `setpgid' instead. The default in GNU is to provide the System V function. The BSD function is available under -D_BSD_SOURCE. */# ifndef __FAVOR_BSD/* Set the process group ID of the calling process to its own PID. This is exactly the same as `setpgid (0, 0)'. */extern int setpgrp (void) __THROW;# else/* Another name for `setpgid' (above). */# ifdef __REDIRECTextern int __REDIRECT (setpgrp, (__pid_t __pid, __pid_t __pgrp) __THROW, setpgid);# else# define setpgrp setpgid# endif# endif /* Favor BSD. */#endif /* Use SVID or BSD. *//* Create a new session with the calling process as its leader. The process group IDs of the session and the calling process are set to the process ID of the calling process, which is returned. */extern __pid_t setsid (void) __THROW;#ifdef __USE_XOPEN_EXTENDED/* Return the session ID of the given process. */extern __pid_t getsid (__pid_t __pid) __THROW;#endif/* Get the real user ID of the calling process. */extern __uid_t getuid (void) __THROW;/* Get the effective user ID of the calling process. */extern __uid_t geteuid (void) __THROW;/* Get the real group ID of the calling process. */extern __gid_t getgid (void) __THROW;/* Get the effective group ID of the calling process. */extern __gid_t getegid (void) __THROW;/* If SIZE is zero, return the number of supplementary groups the calling process is in. Otherwise, fill in the group IDs of its supplementary groups in LIST and return the number written. */extern int getgroups (int __size, __gid_t __list[]) __THROW;#ifdef __USE_GNU/* Return nonzero iff the calling process is in group GID. */extern int group_member (__gid_t __gid) __THROW;#endif/* Set the user ID of the calling process to UID. If the calling process is the super-user, set the real and effective user IDs, and the saved set-user-ID to UID; if not, the effective user ID is set to UID. */extern int setuid (__uid_t __uid) __THROW;#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED/* Set the real user ID of the calling process to RUID, and the effective user ID of the calling process to EUID. */extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW;#endif#if defined __USE_BSD || defined __USE_XOPEN2K/* Set the effective user ID of the calling process to UID. */extern int seteuid (__uid_t __uid) __THROW;#endif /* Use BSD. *//* Set the group ID of the calling process to GID. If the calling process is the super-user, set the real and effective group IDs, and the saved set-group-ID to GID; if not, the effective group ID is set to GID. */extern int setgid (__gid_t __gid) __THROW;#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED/* Set the real group ID of the calling process to RGID, and the effective group ID of the calling process to EGID. */extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW;#endif#if defined __USE_BSD || defined __USE_XOPEN2K/* Set the effective group ID of the calling process to GID. */extern int setegid (__gid_t __gid) __THROW;#endif /* Use BSD. *//* Clone the calling process, creating an exact copy. Return -1 for errors, 0 to the new process, and the process ID of the new process to the old process. */extern __pid_t fork (void) __THROW;#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED/* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is replaced by a call to `execve'. Return -1 for errors, 0 to the new process, and the process ID of the new process to the old process. */extern __pid_t vfork (void) __THROW;#endif /* Use BSD. *//* Return the pathname of the terminal FD is open on, or NULL on errors. The returned storage is good only until the next call to this function. */extern char *ttyname (int __fd) __THROW;/* Store at most BUFLEN characters of the pathname of the terminal FD is
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -