📄 unistd.h
字号:
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 open on in BUF. Return 0 on success, otherwise an error number. */extern int ttyname_r (int __fd, char *__buf, size_t __buflen) __THROW __nonnull ((2));/* Return 1 if FD is a valid descriptor associated with a terminal, zero if not. */extern int isatty (int __fd) __THROW;#if defined __USE_BSD \ || (defined __USE_XOPEN_EXTENDED && !defined __USE_UNIX98)/* Return the index into the active-logins file (utmp) for the controlling terminal. */extern int ttyslot (void) __THROW;#endif/* Make a link to FROM named TO. */extern int link (__const char *__from, __const char *__to) __THROW __nonnull ((1, 2));#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K/* Make a symbolic link to FROM named TO. */extern int symlink (__const char *__from, __const char *__to) __THROW __nonnull ((1, 2));/* Read the contents of the symbolic link PATH into no more than LEN bytes of BUF. The contents are not null-terminated. Returns the number of characters read, or -1 for errors. */extern int readlink (__const char *__restrict __path, char *__restrict __buf, size_t __len) __THROW __nonnull ((1, 2));#endif /* Use BSD. *//* Remove the link NAME. */extern int unlink (__const char *__name) __THROW __nonnull ((1));/* Remove the directory PATH. */extern int rmdir (__const char *__path) __THROW __nonnull ((1));/* Return the foreground process group ID of FD. */extern __pid_t tcgetpgrp (int __fd) __THROW;/* Set the foreground process group ID of FD set PGRP_ID. */extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __THROW;/* Return the login name of the user. This function is a possible cancellation points and therefore not marked with __THROW. */extern char *getlogin (void);#if defined __USE_REENTRANT || defined __USE_UNIX98/* Return at most NAME_LEN characters of the login name of the user in NAME. If it cannot be determined or some other error occurred, return the error code. Otherwise return 0. This function is a possible cancellation points and therefore not marked with __THROW. */extern int getlogin_r (char *__name, size_t __name_len) __nonnull ((1));#endif#ifdef __USE_BSD/* Set the login name returned by `getlogin'. */extern int setlogin (__const char *__name) __THROW __nonnull ((1));#endif#ifdef __USE_POSIX2/* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. */# define __need_getopt# include <getopt.h>#endif#if defined __USE_BSD || defined __USE_UNIX98/* Put the name of the current host in no more than LEN bytes of NAME. The result is null-terminated if LEN is large enough for the full name and the terminator. */extern int gethostname (char *__name, size_t __len) __THROW __nonnull ((1));#endif#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)/* Set the name of the current host to NAME, which is LEN bytes long. This call is restricted to the super-user. */extern int sethostname (__const char *__name, size_t __len) __THROW __nonnull ((1));/* Set the current machine's Internet number to ID. This call is restricted to the super-user. */extern int sethostid (long int __id) __THROW;/* Get and set the NIS (aka YP) domain name, if any. Called just like `gethostname' and `sethostname'. The NIS domain name is usually the empty string when not using NIS. */extern int getdomainname (char *__name, size_t __len) __THROW __nonnull ((1));extern int setdomainname (__const char *__name, size_t __len) __THROW __nonnull ((1));/* Revoke access permissions to all processes currently communicating with the control terminal, and then send a SIGHUP signal to the process group of the control terminal. */extern int vhangup (void) __THROW;/* Revoke the access of all descriptors currently open on FILE. */extern int revoke (__const char *__file) __THROW __nonnull ((1));/* Enable statistical profiling, writing samples of the PC into at most SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling is enabled, the system examines the user PC and increments SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536]. If SCALE is zero, disable profiling. Returns zero on success, -1 on error. */extern int profil (unsigned short int *__sample_buffer, size_t __size, size_t __offset, unsigned int __scale) __THROW __nonnull ((1));/* Turn accounting on if NAME is an existing file. The system will then write a record for each process as it terminates, to this file. If NAME is NULL, turn accounting off. This call is restricted to the super-user. */extern int acct (__const char *__name) __THROW __nonnull ((1));/* Successive calls return the shells listed in `/etc/shells'. */extern char *getusershell (void) __THROW;extern void endusershell (void) __THROW; /* Discard cached info. */extern void setusershell (void) __THROW; /* Rewind and re-read the file. *//* Put the program in the background, and dissociate from the controlling terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, redirects stdin, stdout, and stderr to /dev/null. */extern int daemon (int __nochdir, int __noclose) __THROW;#endif /* Use BSD || X/Open. */#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_XOPEN2K)/* Make PATH be the root directory (the starting point for absolute paths). This call is restricted to the super-user. */extern int chroot (__const char *__path) __THROW __nonnull ((1));/* Prompt with PROMPT and read a string from the terminal without echoing. Uses /dev/tty if possible; otherwise stderr and stdin. */extern char *getpass (__const char *__prompt) __nonnull ((1));#endif /* Use BSD || X/Open. */#if defined __USE_BSD || defined __USE_XOPEN/* Make all changes done to FD actually appear on disk. This function is a cancellation point and therefore not marked with __THROW. */extern int fsync (int __fd);#endif /* Use BSD || X/Open. */#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED/* Return identifier for the current host. */extern long int gethostid (void);/* Make all changes done to all files actually appear on disk. */extern void sync (void) __THROW;/* Return the number of bytes in a page. This is the system's page size, which is not necessarily the same as the hardware page size. */extern int getpagesize (void) __THROW __attribute__ ((__const__));/* Return the maximum number of file descriptors the current process could possibly have. */extern int getdtablesize (void) __THROW;/* Truncate FILE to LENGTH bytes. */# ifndef __USE_FILE_OFFSET64extern int truncate (__const char *__file, __off_t __length) __THROW __nonnull ((1));# else# ifdef __REDIRECT_NTHextern int __REDIRECT_NTH (truncate, (__const char *__file, __off64_t __length), truncate64) __nonnull ((1));# else# define truncate truncate64# endif# endif# ifdef __USE_LARGEFILE64extern int truncate64 (__const char *__file, __off64_t __length) __THROW __nonnull ((1));# endif#endif /* Use BSD || X/Open Unix. */#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K/* Truncate the file FD is open on to LENGTH bytes. */# ifndef __USE_FILE_OFFSET64extern int ftruncate (int __fd, __off_t __length) __THROW;# else# ifdef __REDIRECT_NTHextern int __REDIRECT_NTH (ftruncate, (int __fd, __off64_t __length), ftruncate64);# else# define ftruncate ftruncate64# endif# endif# ifdef __USE_LARGEFILE64extern int ftruncate64 (int __fd, __off64_t __length) __THROW;# endif#endif /* Use BSD || X/Open Unix || POSIX 2003. */#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED/* Set the end of accessible data space (aka "the break") to ADDR. Returns zero on success and -1 for errors (with errno set). */extern int brk (void *__addr) __THROW;/* Increase or decrease the end of accessible data space by DELTA bytes. If successful, returns the address the previous end of data space (i.e. the beginning of the new space, if DELTA > 0); returns (void *) -1 for errors (with errno set). */extern void *sbrk (intptr_t __delta) __THROW;#endif#ifdef __USE_MISC/* Invoke `system call' number SYSNO, passing it the remaining arguments. This is completely system-dependent, and not often useful. In Unix, `syscall' sets `errno' for all errors and most calls return -1 for errors; in many systems you cannot pass arguments or get return values for all system calls (`pipe', `fork', and `getppid' typically among them). In Mach, all system calls take normal arguments and always return an error code (zero for success). */extern long int syscall (long int __sysno, ...) __THROW;#endif /* Use misc. */#if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) && !defined F_LOCK/* NOTE: These declarations also appear in <fcntl.h>; be sure to keep both files consistent. Some systems have them there and some here, and some software depends on the macros being defined without including both. *//* `lockf' is a simpler interface to the locking facilities of `fcntl'. LEN is always relative to the current file position. The CMD argument is one of the following. This function is a cancellation point and therefore not marked with __THROW. */# define F_ULOCK 0 /* Unlock a previously locked region. */# define F_LOCK 1 /* Lock a region for exclusive use. */# define F_TLOCK 2 /* Test and lock a region for exclusive use. */# define F_TEST 3 /* Test a region for other processes locks. */# ifndef __USE_FILE_OFFSET64extern int lockf (int __fd, int __cmd, __off_t __len);# else# ifdef __REDIRECTextern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);# else# define lockf lockf64# endif# endif# ifdef __USE_LARGEFILE64extern int lockf64 (int __fd, int __cmd, __off64_t __len);# endif#endif /* Use misc and F_LOCK not already defined. */#ifdef __USE_GNU/* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno' set to EINTR. */# define TEMP_FAILURE_RETRY(expression) \ (__extension__ \ ({ long int __result; \ do __result = (long int) (expression); \ while (__result == -1L && errno == EINTR); \ __result; }))#endif#if defined __USE_POSIX199309 || defined __USE_UNIX98/* Synchronize at least the data part of a file with the underlying media. */extern int fdatasync (int __fildes) __THROW;#endif /* Use POSIX199309 *//* XPG4.2 specifies that prototypes for the encryption functions must be defined here. */#ifdef __USE_XOPEN/* Encrypt at most 8 characters from KEY using salt to perturb DES. */extern char *crypt (__const char *__key, __const char *__salt) __THROW __nonnull ((1, 2));/* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt block in place. */extern void encrypt (char *__block, int __edflag) __THROW __nonnull ((1));/* Swab pairs bytes in the first N bytes of the area pointed to by FROM and copy the result to TO. The value of TO must not be in the range [FROM - N + 1, FROM - 1]. If N is odd the first byte in FROM is without partner. */extern void swab (__const void *__restrict __from, void *__restrict __to, ssize_t __n) __THROW __nonnull ((1, 2));#endif/* The Single Unix specification demands this prototype to be here. It is also found in <stdio.h>. */#ifdef __USE_XOPEN/* Return the name of the controlling terminal. */extern char *ctermid (char *__s) __THROW __nonnull ((1));#endif__END_DECLS#endif /* unistd.h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -