POSIX 头文件和函数速查

POSIX包含多个标准如C接口,命令行,shell等等

对于C的API

_POSIX_C_SOURCE 检测宏定义

<aio.h>

<arpa/inet.h>

<ctype.h>

<dlfcn.h>

<dirent.h>

<errno.h>

ANIS C 只定义了EDOM、EILSEQ、ERANGE

[E2BIG]Argument list too long.
[EACCES]Permission denied.
[EADDRINUSE]Address in use.
[EADDRNOTAVAIL]Address not available.
[EAFNOSUPPORT]Address family not supported.
[EAGAIN]Resource unavailable, try again (may be the same value as [EWOULDBLOCK]).
[EALREADY]Connection already in progress.
[EBADF]Bad file descriptor.
[EBADMSG]Bad message.
[EBUSY]Device or resource busy.
[ECANCELED]Operation canceled.
[ECHILD]No child processes.
[ECONNABORTED]Connection aborted.
[ECONNREFUSED]Connection refused.
[ECONNRESET]Connection reset.
[EDEADLK]Resource deadlock would occur.
[EDESTADDRREQ]Destination address required.
[EDOM]Mathematics argument out of domain of function.
[EDQUOT]Reserved.
[EEXIST]File exists.
[EFAULT]Bad address.
[EFBIG]File too large.
[EHOSTUNREACH]Host is unreachable.
[EIDRM]Identifier removed.
[EILSEQ]Illegal byte sequence.
[EINPROGRESS]Operation in progress.
[EINTR]Interrupted function.
[EINVAL]Invalid argument.
[EIO]I/O error.
[EISCONN]Socket is connected.
[EISDIR]Is a directory.
[ELOOP]Too many levels of symbolic links.
[EMFILE]File descriptor value too large.
[EMLINK]Too many links.
[EMSGSIZE]Message too large.
[EMULTIHOP]Reserved.
[ENAMETOOLONG]Filename too long.
[ENETDOWN]Network is down.
[ENETRESET]Connection aborted by network.
[ENETUNREACH]Network unreachable.
[ENFILE]Too many files open in system.
[ENOBUFS]No buffer space available.
[ENODATA][OB XSR] No message is available on the STREAM head read queue.
[ENODEV]No such device.
[ENOENT]No such file or directory.
[ENOEXEC]Executable file format error.
[ENOLCK]No locks available.
[ENOLINK]Reserved.
[ENOMEM]Not enough space.
[ENOMSG]No message of the desired type.
[ENOPROTOOPT]Protocol not available.
[ENOSPC]No space left on device.
[ENOSR][OB XSR] No STREAM resources.
[ENOSTR][OB XSR] Not a STREAM.
[ENOSYS]Functionality not supported.
[ENOTCONN]The socket is not connected.
[ENOTDIR]Not a directory or a symbolic link to a directory.
[ENOTEMPTY]Directory not empty.
[ENOTRECOVERABLE]State not recoverable.
[ENOTSOCK]Not a socket.
[ENOTSUP]Not supported (may be the same value as [EOPNOTSUPP]).
[ENOTTY]Inappropriate I/O control operation.
[ENXIO]No such device or address.
[EOPNOTSUPP]Operation not supported on socket (may be the same value as [ENOTSUP]).
[EOVERFLOW]Value too large to be stored in data type.
[EOWNERDEAD]Previous owner died.
[EPERM]Operation not permitted.
[EPIPE]Broken pipe.
[EPROTO]Protocol error.
[EPROTONOSUPPORT]Protocol not supported.
[EPROTOTYPE]Protocol wrong type for socket.
[ERANGE]Result too large.
[EROFS]Read-only file system.
[ESPIPE]Invalid seek.
[ESRCH]No such process.
[ESTALE]Reserved.
[ETIME][OB XSR] Stream ioctl() timeout.
[ETIMEDOUT]Connection timed out.
[ETXTBSY]Text file busy.
[EWOULDBLOCK]Operation would block (may be the same value as [EAGAIN]).
[EXDEV]Cross-device link.

<fcntl.h>

F_DUPFD
F_DUPFD_CLOEXEC
F_GETFD
F_SETFD
F_GETFL
F_SETFL
F_GETLK
F_SETLK
F_SETLKW
F_GETOWN
F_SETOWN
F_RDLCK
F_UNLCK
F_WRLCK

FD_CLOEXEC

O_CLOEXEC
O_CREAT
O_DIRECTORY
O_EXCL
O_NOCTTY
O_NOFOLLOW
O_TRUNC
O_TTY_INIT
O_APPEND
O_DSYNC
O_NONBLOCK
O_RSYNC
O_SYNC
O_ACCMODE
O_EXEC
O_RDONLY
O_RDWR
O_SEARCH
O_WRONLY

AT_FDCWD
AT_EACCESS
AT_SYMLINK_NOFOLLOW
AT_SYMLINK_FOLLOW
AT_REMOVEDIR

POSIX_FADV_DONTNEED
POSIX_FADV_NOREUSE
POSIX_FADV_NORMAL
POSIX_FADV_RANDOM
POSIX_FADV_SEQUENTIAL
POSIX_FADV_WILLNEED

int creat(const char *, mode_t);

int fcntl(int, int, ...);

int open(const char *, int, ...);

int openat(int, const char *, int, ...);

int posix_fadvise(int, off_t, off_t, int);

int posix_fallocate(int, off_t, off_t);

int faccessat(int fd, const char *path, int amode, int flag);

int fchmodat(int fd, const char *path, mode_t mode, int flag);

int fchownat(int fd, const char *path, uid_t owner, gid_t group,        int flag);

int linkat(int fd1, const char *path1, int fd2,        const char *path2, int flag);

int unlinkat(int fd, const char *path, int flag);

<fmtmsg.h>

<fnmatch.h>

<ftw.h>

<glob.h>

<grp.h>

<limits.h>

<math.h>

<mqueue.h>

<ndbm.h>

<netdb.h>

<net/if.h>

<netinet/in.h>

<netinet/tcp.h>

<nl_types.h>

<poll.h>

POLLIN
POLLRDNORM
POLLRDBAND
POLLPRI
POLLOUT
POLLWRNORM
POLLWRBAND
POLLERR
POLLHUP
POLLNVAL

int poll(struct pollfd [], nfds_t, int);

<pthread.h>

<pwd.h>

<regex.h>

<sched.h>

<semaphore.h>

<signal.h>

SIG_DFL    Request for default signal handling.
SIG_ERR    Return value from signal() in case of error.
SIG_HOLD[OB XSI]     Request that signal be held.
SIG_IGN    Request that signal be ignored.

SIGABRT
SIGALRM
SIGBUS
SIGCHLD
SIGCONT
SIGFPE
SIGHUP
SIGILL
SIGINT
SIGKILL
SIGPIPE
SIGQUIT
SIGSEGV
SIGSTOP
SIGTERM
SIGTSTP
SIGTTIN
SIGTTOU
SIGUSR1
SIGUSR2
SIGPOLL
SIGPROF
SIGSYS
SIGTRAP
SIGURG
SIGVTALRM
SIGXCPU
SIGXFSZ

int kill(pid_t, int);

int killpg(pid_t, int);

void psiginfo(const siginfo_t *, const char *);

void psignal(int, const char *);

int pthread_kill(pthread_t, int);

int pthread_sigmask(int, const sigset_t *restrict, sigset_t *restrict);

int sigaction(int, const struct sigaction *restrict, struct sigaction *restrict);

int sigaddset(sigset_t *, int);

int sigaltstack(const stack_t *restrict, stack_t *restrict);

int sigdelset(sigset_t *, int);

int sigemptyset(sigset_t *);

int sigfillset(sigset_t *);

int sighold(int);

int sigignore(int);

int siginterrupt(int, int);

int sigismember(const sigset_t *, int);

int sigpause(int);

int sigpending(sigset_t *);

int sigprocmask(int, const sigset_t *restrict, sigset_t *restrict);

int sigqueue(pid_t, int, union sigval);

int sigrelse(int);

void (*sigset(int, void (*)(int)))(int);

int sigsuspend(const sigset_t *);

int sigtimedwait(const sigset_t *restrict, siginfo_t *restrict, const struct timespec *restrict);

int sigwait(const sigset_t *restrict, int *restrict);

int sigwaitinfo(const sigset_t *restrict, siginfo_t *restrict);

<stropts.h>

<stdlib.h>

<string.h>

<sys/ipc.h>

<sys/mman.h>

<sys/msg.h>

<sys/resource.h>

<sys/select.h>

<sys/sem.h>

<sys/shm.h>

<sys/socket.h>

<sys/stat.h>

S_ISBLK(m)
S_ISCHR(m)
S_ISDIR(m)
S_ISFIFO(m)
S_ISREG(m)
S_ISLNK(m)
S_ISSOCK(m)

int chmod(const char *, mode_t);

int fchmod(int, mode_t);

int fchmodat(int, const char *, mode_t, int);

int fstat(int, struct stat *);

int fstatat(int, const char *restrict, struct stat *restrict, int);

int futimens(int, const struct timespec [2]);

int lstat(const char *restrict, struct stat *restrict);

int mkdir(const char *, mode_t);

int mkdirat(int, const char *, mode_t);

int mkfifo(const char *, mode_t);

int mkfifoat(int, const char *, mode_t);

int mknod(const char *, mode_t, dev_t);

int mknodat(int, const char *, mode_t, dev_t);

int stat(const char *restrict, struct stat *restrict);

mode_t umask(mode_t);

int utimensat(int, const char *, const struct timespec [2], int);

<sys/statvfs.h>

<sys/time.h>

<sys/times.h>

<sys/uio.h>

<sys/un.h>

<sys/utsname.h>

<sys/wait.h>

<syslog.h>

<termios.h>

BRKINT
ICRNL
IGNBRK
IGNCR
IGNPAR
INLCR
INPCK
ISTRIP
IXANY
IXOFF
IXON
PARMRK

OPOST
ONLCR
OCRNL
ONOCR
ONLRET
OFDEL
OFILL
NLDLY
CRDLY
TABDLY
BSDLY
VTDLY
FFDLY

B0
B50
B75
B110
B134
B150
B200
B300
B600
B1200
B1800
B2400
B4800
B9600
B19200
B38400

CSIZE
CSTOPB
CREAD
PARENB
PARODD
HUPCL
CLOCAL

ECHO
ECHOE
ECHOK
ECHONL
ICANON
IEXTEN
ISIG
NOFLSH
TOSTOP

TCSANOW
TCSADRAIN
TCSAFLUSH

TCIFLUSH
TCIOFLUSH
TCOFLUSH
TCIOFF
TCION
TCOOFF
TCOON

speed_t cfgetispeed(const struct termios *);
speed_t cfgetospeed(const struct termios *);
int cfsetispeed(struct termios *, speed_t);
int cfsetospeed(struct termios *, speed_t);
int tcdrain(int);
int tcflow(int, int);
int tcflush(int, int);
int tcgetattr(int, struct termios *);
pid_t tcgetsid(int);
int tcsendbreak(int, int);
int tcsetattr(int, int, const struct termios *);

<time.h>

<ulimit.h>

<unistd.h>

int access(const char *, int);

unsigned alarm(unsigned);

int chdir(const char *);

int chown(const char *, uid_t, gid_t);

int close(int);

size_t confstr(int, char *, size_t);

char *crypt(const char *, const char *);

int dup(int);

int dup2(int, int);

void _exit(int);

void encrypt(char [64], int);

int execl(const char *, const char *, ...);

int execle(const char *, const char *, ...);

int execlp(const char *, const char *, ...);

int execv(const char *, char *const []);

int execve(const char *, char *const [], char *const []);

int execvp(const char *, char *const []);

int faccessat(int, const char *, int, int);

int fchdir(int);

int fchown(int, uid_t, gid_t);

int fchownat(int, const char *, uid_t, gid_t, int);

int fdatasync(int);

int fexecve(int, char *const [], char *const []);

pid_t fork(void);

long fpathconf(int, int);

int fsync(int);

int ftruncate(int, off_t);

char *getcwd(char *, size_t);

gid_t getegid(void);

uid_t geteuid(void);

gid_t getgid(void);

int getgroups(int, gid_t []);

long gethostid(void);

int gethostname(char *, size_t);

char *getlogin(void);

int getlogin_r(char *, size_t);

int getopt(int, char * const [], const char *);

pid_t getpgid(pid_t);

pid_t getpgrp(void);

pid_t getpid(void);

pid_t getppid(void);

pid_t getsid(pid_t);

uid_t getuid(void);

int isatty(int);

int lchown(const char *, uid_t, gid_t);

int link(const char *, const char *);

int linkat(int, const char *, int, const char *, int);

int lockf(int, int, off_t);

off_t lseek(int, off_t, int);

int nice(int);

long pathconf(const char *, int);

int pause(void);

int pipe(int [2]);

ssize_t pread(int, void *, size_t, off_t);

ssize_t pwrite(int, const void *, size_t, off_t);

ssize_t read(int, void *, size_t);

ssize_t readlink(const char *restrict, char *restrict, size_t);

ssize_t readlinkat(int, const char *restrict, char *restrict, size_t);

int rmdir(const char *);

int setegid(gid_t);

int seteuid(uid_t);

int setgid(gid_t);

int setpgid(pid_t, pid_t);

pid_t setpgrp(void);

int setregid(gid_t, gid_t);

int setreuid(uid_t, uid_t);

pid_t setsid(void);

int setuid(uid_t);

unsigned sleep(unsigned);

void swab(const void *restrict, void *restrict, ssize_t);

int symlink(const char *, const char *);

int symlinkat(const char *, int, const char *);

void sync(void);

long sysconf(int);

pid_t tcgetpgrp(int);

int tcsetpgrp(int, pid_t);

int truncate(const char *, off_t);

char *ttyname(int);

int ttyname_r(int, char *, size_t);

int unlink(const char *);

int unlinkat(int, const char *, int);

ssize_t write(int, const void *, size_t);

<utime.h>

<utmpx.h>

<wchar.h>

<wctype.h>

<wordexp.h>

void (*sigev_notify_function)(union sigval)

void psiginfo(const siginfo_t *, const char *);

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 217,826评论 6 506
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,968评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 164,234评论 0 354
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,562评论 1 293
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,611评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,482评论 1 302
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,271评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,166评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,608评论 1 314
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,814评论 3 336
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,926评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,644评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,249评论 3 329
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,866评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,991评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,063评论 3 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,871评论 2 354

推荐阅读更多精彩内容