📄 unistd.h
字号:
/* Copyright (C) 1991-1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *//* * POSIX Standard: 2.10 Symbolic Constants <unistd.h> */#ifndef _UNISTD_H#define _UNISTD_H 1#include <features.h>__BEGIN_DECLS/* These may be used to determine what facilities are present at compile time. Their values can be obtained at run time from `sysconf'. *//* POSIX Standard approved as ISO/IEC 9945-1 as of August, 1988 and extended by POSIX-1b (aka POSIX-4) and POSIX-1c (aka POSIX threads). */#define _POSIX_VERSION 199506L/* These are not #ifdef __USE_POSIX2 because they are in the theoretically application-owned namespace. *//* POSIX Standard approved as ISO/IEC 9945-2 as of December, 1993. */#define _POSIX2_C_VERSION 199209L/* The utilities on GNU systems also correspond to this version. */#define _POSIX2_VERSION 199209L/* If defined, the implementation supports the C Language Bindings Option. */#define _POSIX2_C_BIND 1/* If defined, the implementation supports the C Language Development Utilities Option. */#define _POSIX2_C_DEV 1/* If defined, the implementation supports the Software Development Utilities Option. */#define _POSIX2_SW_DEV 1/* If defined, the implementation supports the creation of locales with the localedef utility. */#define _POSIX2_LOCALEDEF 1/* X/Open version number to which the library conforms. It is selectable. */#ifdef __USE_UNIX98# define _XOPEN_VERSION 500#else# define _XOPEN_VERSION 4#endif/* Commands and utilities from XPG4 are available. */#define _XOPEN_XCU_VERSION 4/* We are compatible with the old published standards as well. */#define _XOPEN_XPG2 1#define _XOPEN_XPG3 1#define _XOPEN_XPG4 1/* The X/Open Unix extensions are available. */#define _XOPEN_UNIX 1/* Encryption is present. */#define _XOPEN_CRYPT 1/* The enhanced internationalization capabilities according to XPG4.2 are present. */#define _XOPEN_ENH_I18N 1/* The legacy interfaces are also available. */#define _XOPEN_LEGACY 1/* Get values of POSIX options: If these symbols are defined, the corresponding features are always available. If not, they may be available sometimes. The current values can be obtained with `sysconf'. _POSIX_JOB_CONTROL Job control is supported. _POSIX_SAVED_IDS Processes have a saved set-user-ID and a saved set-group-ID. _POSIX_REALTIME_SIGNALS Real-time, queued signals are supported. _POSIX_PRIORITY_SCHEDULING Priority scheduling is supported. _POSIX_TIMERS POSIX.4 clocks and timers are supported. _POSIX_ASYNCHRONOUS_IO Asynchronous I/O is supported. _POSIX_PRIORITIZED_IO Prioritized asynchronous I/O is supported. _POSIX_SYNCHRONIZED_IO Synchronizing file data is supported. _POSIX_FSYNC The fsync function is present. _POSIX_MAPPED_FILES Mapping of files to memory is supported. _POSIX_MEMLOCK Locking of all memory is supported. _POSIX_MEMLOCK_RANGE Locking of ranges of memory is supported. _POSIX_MEMORY_PROTECTION Setting of memory protections is supported. _POSIX_MESSAGE_PASSING POSIX.4 message queues are supported. _POSIX_SEMAPHORES POSIX.4 counting semaphores are supported. _POSIX_SHARED_MEMORY_OBJECTS POSIX.4 shared memory objects are supported. _POSIX_THREADS POSIX.1c pthreads are supported. _POSIX_THREAD_ATTR_STACKADDR Thread stack address attribute option supported. _POSIX_THREAD_ATTR_STACKSIZE Thread stack size attribute option supported. _POSIX_THREAD_SAFE_FUNCTIONS Thread-safe functions are supported. _POSIX_THREAD_PRIORITY_SCHEDULING POSIX.1c thread execution scheduling supported. _POSIX_THREAD_PRIO_INHERIT Thread priority inheritance option supported. _POSIX_THREAD_PRIO_PROTECT Thread priority protection option supported. _POSIX_THREAD_PROCESS_SHARED Process-shared synchronization supported. _POSIX_PII Protocol-independent interfaces are supported. _POSIX_PII_XTI XTI protocol-indep. interfaces are supported. _POSIX_PII_SOCKET Socket protocol-indep. interfaces are supported. _POSIX_PII_INTERNET Internet family of protocols supported. _POSIX_PII_INTERNET_STREAM Connection-mode Internet protocol supported. _POSIX_PII_INTERNET_DGRAM Connectionless Internet protocol supported. _POSIX_PII_OSI ISO/OSI family of protocols supported. _POSIX_PII_OSI_COTS Connection-mode ISO/OSI service supported. _POSIX_PII_OSI_CLTS Connectionless ISO/OSI service supported. _POSIX_POLL Implementation supports `poll' function. _POSIX_SELECT Implementation supports `select' and `pselect'. _XOPEN_REALTIME X/Open realtime support is available. _XOPEN_REALTIME_THREADS X/Open realtime thread support is available. _XOPEN_SHM Shared memory interface according to XPG4.2. _XBS5_ILP32_OFF32 Implementation provides environment with 32-bit int, long, pointer, and off_t types. _XBS5_ILP32_OFFBIG Implementation provides environment with 32-bit int, long, and pointer and off_t with at least 64 bits. _XBS5_LP64_OFF64 Implementation provides environment with 32-bit int, and 64-bit long, pointer, and off_t types. _XBS5_LPBIG_OFFBIG Implementation provides environment with at least 32 bits int and long, pointer, and off_t with at least 64 bits. If any of these symbols is defined as -1, the corresponding option is not true for any file. If any is defined as other than -1, the corresponding option is true for all files. If a symbol is not defined at all, the value for a specific file can be obtained from `pathconf' and `fpathconf'. _POSIX_CHOWN_RESTRICTED Only the super user can use `chown' to change the owner of a file. `chown' can only be used to change the group ID of a file to a group of which the calling process is a member. _POSIX_NO_TRUNC Pathname components longer than NAME_MAX generate an error. _POSIX_VDISABLE If defined, if the value of an element of the `c_cc' member of `struct termios' is _POSIX_VDISABLE, no character will have the effect associated with that element. _POSIX_SYNC_IO Synchronous I/O may be performed. _POSIX_ASYNC_IO Asynchronous I/O may be performed. _POSIX_PRIO_IO Prioritized Asynchronous I/O may be performed. Support for the Large File Support interface is not generally available. If it is available the following constants are defined to one. _LFS64_LARGEFILE Low-level I/O supports large files. _LFS64_STDIO Standard I/O supports large files. */#include <bits/posix_opt.h>/* Get the environment definitions from Unix98. */#ifdef __USE_UNIX98# include <bits/environments.h>#endif/* Standard file descriptors. */#define STDIN_FILENO 0 /* Standard input. */#define STDOUT_FILENO 1 /* Standard output. */#define STDERR_FILENO 2 /* Standard error output. *//* All functions that are not declared anywhere else. */#include <bits/types.h>#ifndef __ssize_t_definedtypedef __ssize_t ssize_t;# define __ssize_t_defined#endif#define __need_size_t#define __need_NULL#include <stddef.h>#ifdef __USE_XOPEN/* The Single Unix specification says that some more types are available here. */# ifndef __gid_t_definedtypedef __gid_t gid_t;# define __gid_t_defined# endif# ifndef __uid_t_definedtypedef __uid_t uid_t;# define __uid_t_defined# endif# ifndef __off_t_defined# ifndef __USE_FILE_OFFSET64typedef __off_t off_t;# elsetypedef __off64_t off_t;# endif# define __off_t_defined# endif# if defined __USE_LARGEFILE64 && !defined __off64_t_definedtypedef __off64_t off64_t;# define __off64_t_defined# endif# ifndef __useconds_t_definedtypedef __useconds_t useconds_t;# define __useconds_t_defined# endif# ifndef __pid_t_definedtypedef __pid_t pid_t;# define __pid_t_defined# endif#endif /* X/Open */#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED# ifndef __intptr_t_definedtypedef __intptr_t intptr_t;# define __intptr_t_defined# endif#endif#if defined __USE_BSD || defined __USE_XOPEN# ifndef __socklen_t_definedtypedef __socklen_t socklen_t;# define __socklen_t_defined# endif#endif/* Values for the second argument to access. These may be OR'd together. */#define R_OK 4 /* Test for read permission. */#define W_OK 2 /* Test for write permission. */#define X_OK 1 /* Test for execute permission. */#define F_OK 0 /* Test for existence. *//* Test for access to NAME using the real UID and real GID. */extern int access (__const char *__name, int __type) __THROW;#ifdef __USE_GNU/* Test for access to NAME using the effective UID and GID (as normal file operations use). */extern int euidaccess (__const char *__name, int __type) __THROW;#endif/* Values for the WHENCE argument to lseek. */#ifndef _STDIO_H /* <stdio.h> has the same definitions. */# define SEEK_SET 0 /* Seek from beginning of file. */# define SEEK_CUR 1 /* Seek from current position. */# define SEEK_END 2 /* Seek from end of file. */#endif#if defined __USE_BSD && !defined L_SET/* Old BSD names for the same constants; just for compatibility. */# define L_SET SEEK_SET# define L_INCR SEEK_CUR# define L_XTND SEEK_END#endif/* Move FD's file position to OFFSET bytes from the beginning of the file (if WHENCE is SEEK_SET), the current position (if WHENCE is SEEK_CUR), or the end of the file (if WHENCE is SEEK_END). Return the new file position. */#ifndef __USE_FILE_OFFSET64extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW;#else# ifdef __REDIRECTextern __off64_t __REDIRECT (lseek, (int __fd, __off64_t __offset, int __whence) __THROW, lseek64);# else# define lseek lseek64# endif#endif#ifdef __USE_LARGEFILE64extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence) __THROW;#endif/* Close the file descriptor FD. */extern int close (int __fd) __THROW;/* Read NBYTES into BUF from FD. Return the number read, -1 for errors or 0 for EOF. */extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __THROW;/* Write N bytes of BUF to FD. Return the number written, or -1. */extern ssize_t write (int __fd, __const void *__buf, size_t __n) __THROW;#ifdef __USE_UNIX98# ifndef __USE_FILE_OFFSET64extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) __THROW;extern ssize_t pwrite (int __fd, __const void *__buf, size_t __n, __off_t __offset) __THROW;# else# ifdef __REDIRECTextern ssize_t __REDIRECT (pread, (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) __THROW, pread64);extern ssize_t __REDIRECT (pwrite, (int __fd, __const void *__buf, size_t __nbytes, __off64_t __offset) __THROW, pwrite64);# else# define pread pread64# define pwrite pwrite64# endif# endif# ifdef __USE_LARGEFILE64/* Read NBYTES into BUF from FD at the given position OFFSET without
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -