📄 unistd.h
字号:
open on in BUF. Return 0 on success, otherwise an error number. */extern int ttyname_r (int __fd, char *__buf, size_t __buflen) __THROW;/* 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;#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED/* Make a symbolic link to FROM named TO. */extern int symlink (__const char *__from, __const char *__to) __THROW;/* 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;#endif /* Use BSD. *//* Remove the link NAME. */extern int unlink (__const char *__name) __THROW;/* Remove the directory PATH. */extern int rmdir (__const char *__path) __THROW;/* 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. */extern char *getlogin (void) __THROW;#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. */extern int getlogin_r (char *__name, size_t __name_len) __THROW;#endif#ifdef __USE_BSD/* Set the login name returned by `getlogin'. */extern int setlogin (__const char *__name) __THROW;#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_XOPEN2K/* 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;#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;/* 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;extern int setdomainname (__const char *__name, size_t __len) __THROW;/* 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;/* 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;/* 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;/* 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;/* 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) __THROW;#endif /* Use BSD || X/Open. */#if defined __USE_BSD || defined __USE_XOPEN/* Make all changes done to FD actually appear on disk. */extern int fsync (int __fd) __THROW;#endif /* Use BSD || X/Open. */#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED/* Return the current machine's Internet number. */extern long int gethostid (void) __THROW;/* 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__));/* Truncate FILE to LENGTH bytes. */# ifndef __USE_FILE_OFFSET64extern int truncate (__const char *__file, __off_t __length) __THROW;# else# ifdef __REDIRECTextern int __REDIRECT (truncate, (__const char *__file, __off64_t __length) __THROW, truncate64);# else# define truncate truncate64# endif# endif# ifdef __USE_LARGEFILE64extern int truncate64 (__const char *__file, __off64_t __length) __THROW;# endif/* Truncate the file FD is open on to LENGTH bytes. */# ifndef __USE_FILE_OFFSET64extern int ftruncate (int __fd, __off_t __length) __THROW;# else# ifdef __REDIRECTextern int __REDIRECT (ftruncate, (int __fd, __off64_t __length) __THROW, ftruncate64);# else# define ftruncate ftruncate64# endif# endif# ifdef __USE_LARGEFILE64extern int ftruncate64 (int __fd, __off64_t __length) __THROW;# endif/* Return the maximum number of file descriptors the current process could possibly have. */extern int getdtablesize (void) __THROW;#endif /* Use BSD || X/Open Unix. */#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. */# 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) __THROW;# else# ifdef __REDIRECTextern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len) __THROW, lockf64);# else# define lockf lockf64# endif# endif# ifdef __USE_LARGEFILE64extern int lockf64 (int __fd, int __cmd, __off64_t __len) __THROW;# 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;/* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt block in place. */extern void encrypt (char *__block, int __edflag) __THROW;/* 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;#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;#endif#ifdef __USE_POSIX199309/* This function is only available if the system has POSIX threads. *//* Install handlers to be called when a new process is created with FORK. The PREPARE handler is called in the parent process just before performing FORK. The PARENT handler is called in the parent process just after FORK. The CHILD handler is called in the child process. Each of the three handlers can be NULL, meaning that no handler needs to be called at that point. PTHREAD_ATFORK can be called several times, in which case the PREPARE handlers are called in LIFO order (last added with PTHREAD_ATFORK, first called before FORK), and the PARENT and CHILD handlers are called in FIFO (first added, first called). */extern int pthread_atfork (void (*__prepare) (void), void (*__parent) (void), void (*__child) (void)) __THROW;#endif__END_DECLS#endif /* unistd.h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -