accept - accept a connection on a socket #include /* See NOTES */ #include int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags); access - check real user's permissions for a file #include int access(const char *pathname, int mode); acct - switch process accounting on or off #include int acct(const char *filename); add_key - Add a key to the kernel's key management facility #include key_serial_t add_key(const char *type, const char *description, const void *payload, size_t plen, key_serial_t keyring); adjtime - smoothly tune kernel clock #include int adjtime(const struct timeval *delta, struct timeval *olddelta); adjtimex - tune kernel clock #include int adjtimex(struct timex *buf); alarm - set an alarm clock for delivery of a signal #include unsigned int alarm(unsigned int seconds); alloc_hugepages, free_hugepages - allocate or free huge pages void *alloc_hugepages(int key, void *addr, size_t len, int prot, int flag); int free_hugepages(void *addr); arch_prctl - set architecture-specific thread state #include #include int arch_prctl(int code, unsigned long addr); int arch_prctl(int code, unsigned long *addr); bdflush - start, flush, or tune buffer-dirty-flush daemon #include int bdflush(int func, long *address); int bdflush(int func, long data); bind - bind a name to a socket #include /* See NOTES */ #include int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); brk, sbrk - change data segment size #include int brk(void *addr); void *sbrk(intptr_t increment); cacheflush - flush contents of instruction and/or data cache #include int cacheflush(char *addr, int nbytes, int cache); capget, capset - set/get capabilities of thread(s) #include int capget(cap_user_header_t hdrp, cap_user_data_t datap); int capset(cap_user_header_t hdrp, const cap_user_data_t datap); chdir, fchdir - change working directory #include int chdir(const char *path); int fchdir(int fd); chmod, fchmod - change permissions of a file #include int chmod(const char *path, mode_t mode); int fchmod(int fd, mode_t mode); chown, fchown, lchown - change ownership of a file #include int chown(const char *path, uid_t owner, gid_t group); int fchown(int fd, uid_t owner, gid_t group); int lchown(const char *path, uid_t owner, gid_t group); chroot - change root directory #include int chroot(const char *path); clock_getres, clock_gettime, clock_settime - clock and time functions #include int clock_getres(clockid_t clk_id, struct timespec *res); int clock_gettime(clockid_t clk_id, struct timespec *tp); int clock_settime(clockid_t clk_id, const struct timespec *tp); Link with -lrt. clock_nanosleep - high-resolution sleep with specifiable clock #include int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *request, struct timespec *remain); Link with -lrt. clone, __clone2 - create a child process #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ... /* pid_t *ptid, struct user_desc *tls, pid_t *ctid */ ); close - close a file descriptor #include int close(int fd); connect - initiate a connection on a socket #include /* See NOTES */ #include int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); dup, dup2, dup3 - duplicate a file descriptor #include int dup(int oldfd); int dup2(int oldfd, int newfd); #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int dup3(int oldfd, int newfd, int flags); epoll_create, epoll_create1 - open an epoll file descriptor #include int epoll_create(int size); int epoll_create1(int flags); epoll_ctl - control interface for an epoll descriptor #include int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event); epoll_wait, epoll_pwait - wait for an I/O event on an epoll file descriptor #include int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout); int epoll_pwait(int epfd, struct epoll_event *events, int maxevents, int timeout, const sigset_t *sigmask); eventfd - create a file descriptor for event notification #include int eventfd(unsigned int initval, int flags); execve - execute program #include int execve(const char *filename, char *const argv[], char *const envp[]); _exit, _Exit - terminate the calling process #include void _exit(int status); #include void _Exit(int status); exit_group - exit all threads in a process #include void exit_group(int status); faccessat - check user's permissions of a file relative to a directory file descriptor #include /* Definition of AT_* constants */ #include int faccessat(int dirfd, const char *pathname, int mode, int flags); fallocate - manipulate file space #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int fallocate(int fd, int mode, off_t offset, off_t len); fchmodat - change permissions of a file relative to a directory file descriptor #include /* Definition of AT_* constants */ #include int fchmodat(int dirfd, const char *pathname, mode_t mode, int flags); fchownat - change ownership of a file relative to a directory file descriptor #include /* Definition of AT_* constants */ #include int fchownat(int dirfd, const char *pathname, uid_t owner, gid_t group, int flags); fcntl - manipulate file descriptor #include #include int fcntl(int fd, int cmd, ... /* arg */ ); flock - apply or remove an advisory lock on an open file #include int flock(int fd, int operation); fork - create a child process #include pid_t fork(void); fstatat - get file status relative to a directory file descriptor #include /* Definition of AT_* constants */ #include int fstatat(int dirfd, const char *pathname, struct stat *buf, int flags); fsync, fdatasync - synchronize a file's in-core state with storage device #include int fsync(int fd); int fdatasync(int fd); futex - Fast Userspace Locking system call #include #include int futex(int *uaddr, int op, int val, const struct timespec *timeout, int *uaddr2, int val3); futimesat - change timestamps of a file relative to a directory file descriptor #include /* Definition of AT_* constants */ int futimesat(int dirfd, const char *pathname, const struct timeval times[2]); getcontext, setcontext - get or set the user context #include int getcontext(ucontext_t *ucp); int setcontext(const ucontext_t *ucp); getcpu - determine CPU and NUMA node on which the calling thread is running #include int getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache); getdents - get directory entries int getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int count); getdomainname, setdomainname - get/set domain name #include int getdomainname(char *name, size_t len); int setdomainname(const char *name, size_t len); getdtablesize - get descriptor table size #include int getdtablesize(void); getgid, getegid - get group identity #include #include gid_t getgid(void); gid_t getegid(void); getgroups, setgroups - get/set list of supplementary group IDs #include #include int getgroups(int size, gid_t list[]); #include int setgroups(size_t size, const gid_t *list); gethostname, sethostname - get/set hostname #include int gethostname(char *name, size_t len); int sethostname(const char *name, size_t len); getitimer, setitimer - get or set value of an interval timer #include int getitimer(int which, struct itimerval *curr_value); int setitimer(int which, const struct itimerval *new_value, struct itimerval *old_value); get_mempolicy - Retrieve NUMA memory policy for a process #include int get_mempolicy(int *mode, unsigned long *nodemask, unsigned long maxnode, unsigned long addr, unsigned long flags); Link with -lnuma. getpagesize - get memory page size #include int getpagesize(void); getpeername - get name of connected peer socket #include int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen); getpid, getppid - get process identification #include #include pid_t getpid(void); pid_t getppid(void); getpriority, setpriority - get/set program scheduling priority #include #include int getpriority(int which, int who); int setpriority(int which, int who, int prio); getresuid, getresgid - get real, effective and saved user/group IDs #define _GNU_SOURCE #include int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); getrlimit, setrlimit - get/set resource limits #include #include int getrlimit(int resource, struct rlimit *rlim); int setrlimit(int resource, const struct rlimit *rlim); getrusage - get resource usage #include #include int getrusage(int who, struct rusage *usage); getsid - get session ID #include pid_t getsid(pid_t pid); getsockname - get socket name #include int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen); getsockopt, setsockopt - get and set options on sockets #include /* See NOTES */ #include int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen); int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen); get_thread_area - Get a Thread Local Storage (TLS) area #include #include int get_thread_area(struct user_desc *u_info); gettid - get thread identification #include pid_t gettid(void); gettimeofday, settimeofday - get / set time #include int gettimeofday(struct timeval *tv, struct timezone *tz); int settimeofday(const struct timeval *tv, const struct timezone *tz); getuid, geteuid - get user identity #include #include uid_t getuid(void); uid_t geteuid(void); idle - make process 0 idle #include int idle(void); inotify_add_watch - add a watch to an initialized inotify instance #include int inotify_add_watch(int fd, const char *pathname, uint32_t mask); inotify_init, inotify_init1 - initialize an inotify instance #include int inotify_init(void); int inotify_init1(int flags); inotify_rm_watch - remove an existing watch from an inotify instance #include int inotify_rm_watch(int fd, uint32_t wd); io_cancel - cancel an outstanding asynchronous I/O operation #include int io_cancel(aio_context_t ctx_id, struct iocb *iocb, struct io_event *result); Link with -laio. ioctl - control device #include int ioctl(int d, int request, ...); ioctl_list - list of ioctl calls in Linux/i386 kernel io_destroy - destroy an asynchronous I/O context #include int io_destroy(aio_context_t ctx); Link with -laio. io_getevents - read asynchronous I/O events from the completion queue #include #include int io_getevents(aio_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout); Link with -laio. ioperm - set port input/output permissions #include /* for libc5 */ #include /* for glibc */ int ioperm(unsigned long from, unsigned long num, int turn_on); iopl - change I/O privilege level #include int iopl(int level); ioprio_get, ioprio_set - get/set I/O scheduling class and priority int ioprio_get(int which, int who); int ioprio_set(int which, int who, int ioprio); io_setup - create an asynchronous I/O context #include int io_setup(unsigned nr_events, aio_context_t *ctxp); Link with -laio. io_submit - submit asynchronous I/O blocks for processing #include int io_submit(aio_context_t ctx_id, long nr, struct iocb **iocbpp); Link with -laio. ipc - System V IPC system calls int ipc(unsigned int call, int first, int second, int third, void *ptr, long fifth); keyctl - Manipulate the kernel's key management facility #include long keyctl(int cmd, ...); kill - send signal to a process #include #include int kill(pid_t pid, int sig); killpg - send signal to a process group #include int killpg(int pgrp, int sig); link - make a new name for a file #include int link(const char *oldpath, const char *newpath); linkat - create a file link relative to directory file descriptors #include /* Definition of AT_* constants */ #include int linkat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, int flags); listen - listen for connections on a socket #include /* See NOTES */ #include int listen(int sockfd, int backlog); _llseek - reposition read/write file offset #include #include int _llseek(unsigned int fd, unsigned long offset_high, unsigned long offset_low, loff_t *result, unsigned int whence); lookup_dcookie - return a directory entry's path int lookup_dcookie(u64 cookie, char *buffer, size_t len); lseek - reposition read/write file offset #include #include off_t lseek(int fd, off_t offset, int whence); madvise - give advice about use of memory #include int madvise(void *addr, size_t length, int advice); mbind - Set memory policy for a memory range #include int mbind(void *addr, unsigned long len, int mode, unsigned long *nodemask, unsigned long maxnode, unsigned flags); Link with -lnuma. migrate_pages - move all pages in a process to another set of nodes #include long migrate_pages(int pid, unsigned long maxnode, const unsigned long *old_nodes, const unsigned long *new_nodes); Link with -lnuma. mincore - determine whether pages are resident in memory #include #include int mincore(void *addr, size_t length, unsigned char *vec); mkdir - create a directory #include #include int mkdir(const char *pathname, mode_t mode); mkdirat - create a directory relative to a directory file descriptor #include /* Definition of AT_* constants */ #include int mkdirat(int dirfd, const char *pathname, mode_t mode); mknod - create a special or ordinary file #include #include #include #include int mknod(const char *pathname, mode_t mode, dev_t dev); mknodat - create a special or ordinary file relative to a directory file descriptor #include /* Definition of AT_* constants */ #include int mknodat(int dirfd, const char *pathname, mode_t mode, dev_t dev); mlock, munlock, mlockall, munlockall - lock and unlock memory #include int mlock(const void *addr, size_t len); int munlock(const void *addr, size_t len); int mlockall(int flags); int munlockall(void); mmap2 - map files or devices into memory #include void *mmap2(void *addr, size_t length, int prot, int flags, int fd, off_t pgoffset); mmap, munmap - map or unmap files or devices into memory #include void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); int munmap(void *addr, size_t length); modify_ldt - get or set ldt #include int modify_ldt(int func, void *ptr, unsigned long bytecount); mount - mount file system #include int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data); move_pages - move individual pages of a process to another node #include long move_pages(int pid, unsigned long count, void **pages, const int *nodes, int *status, int flags); Link with -lnuma. mprotect - set protection on a region of memory #include int mprotect(const void *addr, size_t len, int prot); mq_getsetattr - get/set message queue attributes #include #include int mq_getsetattr(mqd_t mqdes, struct mq_attr *newattr, struct mq_attr *oldattr); mremap - remap a virtual memory address #define _GNU_SOURCE #include void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */); msgctl - message control operations #include #include #include int msgctl(int msqid, int cmd, struct msqid_ds *buf); msgget - get a message queue identifier #include #include #include int msgget(key_t key, int msgflg); msgrcv, msgsnd - message operations #include #include #include int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); msync - synchronize a file with a memory map #include int msync(void *addr, size_t length, int flags); nanosleep - high-resolution sleep #include int nanosleep(const struct timespec *req, struct timespec *rem); nfsservctl - syscall interface to kernel nfs daemon #include long nfsservctl(int cmd, struct nfsctl_arg *argp, union nfsctl_res *resp); nice - change process priority #include int nice(int inc); open, creat - open and possibly create a file or device #include #include #include int open(const char *pathname, int flags); int open(const char *pathname, int flags, mode_t mode); int creat(const char *pathname, mode_t mode); openat - open a file relative to a directory file descriptor #include int openat(int dirfd, const char *pathname, int flags); int openat(int dirfd, const char *pathname, int flags, mode_t mode); outb, outw, outl, outsb, outsw, outsl, inb, inw, inl, insb, insw, insl, outb_p, outw_p, outl_p, inb_p, inw_p, inl_p - port I/O pause - wait for signal #include int pause(void); pciconfig_read, pciconfig_write, pciconfig_iobase - pci device informa‐ tion handling #include int pciconfig_read(unsigned long bus, unsigned long dfn, unsigned long off, unsigned long len, void *buf); int pciconfig_write(unsigned long bus, unsigned long dfn, unsigned long off, unsigned long len, void *buf); int pciconfig_iobase(long which, unsigned long bus, unsigned long devfn); personality - set the process execution domain #include int personality(unsigned long persona); pipe, pipe2 - create pipe #include int pipe(int pipefd[2]); #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int pipe2(int pipefd[2], int flags); pivot_root - change the root file system int pivot_root(const char *new_root, const char *put_old); poll, ppoll - wait for some event on a file descriptor #include int poll(struct pollfd *fds, nfds_t nfds, int timeout); #define _GNU_SOURCE #include int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts, const sigset_t *sigmask); posix_fadvise - predeclare an access pattern for file data #include int posix_fadvise(int fd, off_t offset, off_t len, int advice); prctl - operations on a process #include int prctl(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5); pread, pwrite - read from or write to a file descriptor at a given off‐ set #include ssize_t pread(int fd, void *buf, size_t count, off_t offset); ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); ptrace - process trace #include long ptrace(enum __ptrace_request request, pid_t pid, void *addr, void *data); quotactl - manipulate disk quotas #include #include int quotactl(int cmd, const char *special, int id, caddr_t addr); read - read from a file descriptor #include ssize_t read(int fd, void *buf, size_t count); readahead - perform file readahead into page cache #define _GNU_SOURCE /* See feature_test_macros(7) */ #include ssize_t readahead(int fd, off64_t offset, size_t count); readdir - read directory entry int readdir(unsigned int fd, struct old_linux_dirent *dirp, unsigned int count); readlink - read value of a symbolic link #include ssize_t readlink(const char *path, char *buf, size_t bufsiz); readlinkat - read value of a symbolic link relative to a directory file descriptor #include /* Definition of AT_* constants */ #include int readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz); readv, writev - read or write data into multiple buffers #include ssize_t readv(int fd, const struct iovec *iov, int iovcnt); ssize_t writev(int fd, const struct iovec *iov, int iovcnt); reboot - reboot or enable/disable Ctrl-Alt-Del /* For libc4 and libc5 the library call and the system call are identical, and since kernel version 2.1.30 there are symbolic names LINUX_REBOOT_* for the constants and a fourth argument to the call: */ #include #include int reboot(int magic, int magic2, int cmd, void *arg); /* Under glibc some of the constants involved have gotten symbolic names RB_*, and the library call is a 1-argument wrapper around the 3-argument system call: */ #include #include int reboot(int cmd); recv, recvfrom, recvmsg - receive a message from a socket #include #include ssize_t recv(int sockfd, void *buf, size_t len, int flags); ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen); ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags); remap_file_pages - create a nonlinear file mapping #define _GNU_SOURCE #include int remap_file_pages(void *addr, size_t size, int prot, ssize_t pgoff, int flags); rename - change the name or location of a file #include int rename(const char *oldpath, const char *newpath); renameat - rename a file relative to directory file descriptors #include /* Definition of AT_* constants */ #include int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath); request_key - Request a key from the kernel's key management facility #include key_serial_t request_key(const char *type, const char *description, const char *callout_info, key_serial_t keyring); rmdir - delete a directory #include int rmdir(const char *pathname); sched_get_priority_max, sched_get_priority_min - get static priority range #include int sched_get_priority_max(int policy); int sched_get_priority_min(int policy); sched_rr_get_interval - get the SCHED_RR interval for the named process #include int sched_rr_get_interval(pid_t pid, struct timespec * tp); sched_setaffinity, sched_getaffinity - set and get a process's CPU affinity mask #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int sched_setaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask); int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask); sched_setparam, sched_getparam - set and get scheduling parameters #include int sched_setparam(pid_t pid, const struct sched_param *param); int sched_getparam(pid_t pid, struct sched_param *param); struct sched_param { ... int sched_priority; ... }; sched_setscheduler, sched_getscheduler - set and get scheduling pol‐ icy/parameters #include int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param); int sched_getscheduler(pid_t pid); struct sched_param { ... int sched_priority; ... }; sched_yield - yield the processor #include int sched_yield(void); select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO - synchronous I/O multiplexing /* According to POSIX.1-2001 */ #include /* According to earlier standards */ #include #include #include int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); void FD_CLR(int fd, fd_set *set); int FD_ISSET(int fd, fd_set *set); void FD_SET(int fd, fd_set *set); void FD_ZERO(fd_set *set); #include int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, const sigset_t *sigmask); select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO - synchronous I/O multiplexing /* According to POSIX.1-2001 */ #include /* According to earlier standards */ #include #include #include int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *utimeout); void FD_CLR(int fd, fd_set *set); int FD_ISSET(int fd, fd_set *set); void FD_SET(int fd, fd_set *set); void FD_ZERO(fd_set *set); #include int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *ntimeout, const sigset_t *sigmask); semctl - semaphore control operations #include #include #include int semctl(int semid, int semnum, int cmd, ...); semget - get a semaphore set identifier #include #include #include int semget(key_t key, int nsems, int semflg); semop, semtimedop - semaphore operations #include #include #include int semop(int semid, struct sembuf *sops, unsigned nsops); int semtimedop(int semid, struct sembuf *sops, unsigned nsops, struct timespec *timeout); send, sendto, sendmsg - send a message on a socket #include #include ssize_t send(int sockfd, const void *buf, size_t len, int flags); ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen); ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags); sendfile - transfer data between file descriptors #include ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count); seteuid, setegid - set effective user or group ID #include #include int seteuid(uid_t euid); int setegid(gid_t egid); setfsgid - set group identity used for file system checks #include /* glibc uses */ int setfsgid(uid_t fsgid); setfsuid - set user identity used for file system checks #include /* glibc uses */ int setfsuid(uid_t fsuid); setgid - set group identity #include #include int setgid(gid_t gid); setpgid, getpgid, setpgrp, getpgrp - set/get process group #include int setpgid(pid_t pid, pid_t pgid); pid_t getpgid(pid_t pid); pid_t getpgrp(void); /* POSIX.1 version */ pid_t getpgrp(pid_t pid); /* BSD version */ int setpgrp(void); /* System V version */ int setpgrp(pid_t pid, pid_t pgid); /* BSD version */ setresuid, setresgid - set real, effective and saved user or group ID #define _GNU_SOURCE #include int setresuid(uid_t ruid, uid_t euid, uid_t suid); int setresgid(gid_t rgid, gid_t egid, gid_t sgid); setreuid, setregid - set real and/or effective user or group ID #include #include int setreuid(uid_t ruid, uid_t euid); int setregid(gid_t rgid, gid_t egid); setsid - creates a session and sets the process group ID #include pid_t setsid(void); set_thread_area - Set a Thread Local Storage (TLS) area #include #include int set_thread_area(struct user_desc *u_info); set_tid_address - set pointer to thread ID #include long set_tid_address(int *tidptr); setuid - set user identity #include #include int setuid(uid_t uid); setup - setup devices and file systems, mount root file system #include int setup(void); sgetmask, ssetmask - manipulation of signal mask (obsolete) long sgetmask(void); long ssetmask(long newmask); shmctl - shared memory control #include #include int shmctl(int shmid, int cmd, struct shmid_ds *buf); shmget - allocates a shared memory segment #include #include int shmget(key_t key, size_t size, int shmflg); shmat, shmdt - shared memory operations #include #include void *shmat(int shmid, const void *shmaddr, int shmflg); int shmdt(const void *shmaddr); shutdown - shut down part of a full-duplex connection #include int shutdown(int sockfd, int how); sigaction - examine and change a signal action #include int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); sigaltstack - set and/or get signal stack context #include int sigaltstack(const stack_t *ss, stack_t *oss); signal - ANSI C signal handling #include typedef void (*sighandler_t)(int); sighandler_t signal(int signum, sighandler_t handler); signalfd - create a file descriptor for accepting signals #include int signalfd(int fd, const sigset_t *mask, int flags); sigpending - examine pending signals #include int sigpending(sigset_t *set); sigprocmask - examine and change blocked signals #include int sigprocmask(int how, const sigset_t *set, sigset_t *oldset); sigqueue, rt_sigqueueinfo - queue a signal and data to a process #include int sigqueue(pid_t pid, int sig, const union sigval value); sigreturn - return from signal handler and cleanup stack frame int sigreturn(unsigned long __unused); sigsuspend - wait for a signal #include int sigsuspend(const sigset_t *mask); sigwaitinfo, sigtimedwait - synchronously wait for queued signals #include int sigwaitinfo(const sigset_t *set, siginfo_t *info); int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout); socket - create an endpoint for communication #include /* See NOTES */ #include int socket(int domain, int type, int protocol); socketcall - socket system calls int socketcall(int call, unsigned long *args); socketpair - create a pair of connected sockets #include /* See NOTES */ #include int socketpair(int domain, int type, int protocol, int sv[2]); splice - splice data to/from a pipe #define _GNU_SOURCE #include ssize_t splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags); spu_create - create a new spu context #include #include int spu_create(const char *pathname, int flags, mode_t mode); int spu_create(const char *pathname, int flags, mode_t mode, int neighbor_fd); spu_run - execute an SPU context #include int spu_run(int fd, unsigned int *npc, unsigned int *event); stat, fstat, lstat - get file status #include #include #include int stat(const char *path, struct stat *buf); int fstat(int fd, struct stat *buf); int lstat(const char *path, struct stat *buf); statfs, fstatfs - get file system statistics #include /* or */ int statfs(const char *path, struct statfs *buf); int fstatfs(int fd, struct statfs *buf); stime - set time #include int stime(time_t *t); swapon, swapoff - start/stop swapping to file/device #include #include /* to find PAGE_SIZE */ #include int swapon(const char *path, int swapflags); int swapoff(const char *path); symlink - make a new name for a file #include int symlink(const char *oldpath, const char *newpath); symlinkat - create a symbolic link relative to a directory file descriptor #include /* Definition of AT_* constants */ #include int symlinkat(const char *oldpath, int newdirfd, const char *newpath); sync - commit buffer cache to disk #include void sync(void); sync_file_range - sync a file segment with disk #define _GNU_SOURCE #include int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags); _syscall - invoking a system call without library support (OBSOLETE) #include A _syscall macro desired system call syscall - indirect system call #define _GNU_SOURCE /* or _BSD_SOURCE or _SVID_SOURCE */ #include #include /* For SYS_xxx definitions */ int syscall(int number, ...); syscalls - Linux system calls Linux system calls. sysctl - read/write system parameters #include #include int _sysctl(struct __sysctl_args *args); sysfs - get file system type information int sysfs(int option, const char *fsname); int sysfs(int option, unsigned int fs_index, char *buf); int sysfs(int option); sysinfo - returns information on overall system statistics #include int sysinfo(struct sysinfo *info); syslog, klogctl - read and/or clear kernel message ring buffer; set console_loglevel int syslog(int type, char *bufp, int len); /* No wrapper provided in glibc */ /* The glibc interface */ #include int klogctl(int type, char *bufp, int len); tee - duplicating pipe content #define _GNU_SOURCE #include ssize_t tee(int fd_in, int fd_out, size_t len, unsigned int flags); time - get time in seconds #include time_t time(time_t *t); timer_create - create a POSIX per-process timer #include #include int timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid); Link with -lrt. timer_delete - delete a POSIX per-process timer #include int timer_delete(timer_t timerid); Link with -lrt. timerfd_create, timerfd_settime, timerfd_gettime - timers that notify via file descriptors #include int timerfd_create(int clockid, int flags); int timerfd_settime(int fd, int flags, const struct itimerspec *new_value, struct itimerspec *old_value); int timerfd_gettime(int fd, struct itimerspec *curr_value); timer_getoverrun - get overrun count for a POSIX per-process timer #include int timer_getoverrun(timer_t timerid); Link with -lrt. timer_settime, timer_gettime - arm/disarm and fetch state of POSIX per- process timer #include int timer_settime(timer_t timerid, int flags, const struct itimerspec *new_value, struct itimerspec * old_value); int timer_gettime(timer_t timerid, struct itimerspec *curr_value); Link with -lrt. times - get process times #include clock_t times(struct tms *buf); tkill, tgkill - send a signal to a thread int tkill(int tid, int sig); int tgkill(int tgid, int tid, int sig); truncate, ftruncate - truncate a file to a specified length #include #include int truncate(const char *path, off_t length); int ftruncate(int fd, off_t length); umask - set file mode creation mask #include #include mode_t umask(mode_t mask); umount, umount2 - unmount file system #include int umount(const char *target); int umount2(const char *target, int flags); uname - get name and information about current kernel #include int uname(struct utsname *buf); afs_syscall, break, ftime, getpmsg, gtty, lock, madvise1, mpx, prof, profil, putpmsg, security, stty, tuxcall, ulimit, vserver - unimple‐ mented system calls Unimplemented system calls. unlink - delete a name and possibly the file it refers to #include int unlink(const char *pathname); unlinkat - remove a directory entry relative to a directory file descriptor #include int unlinkat(int dirfd, const char *pathname, int flags); unshare - disassociate parts of the process execution context define _GNU_SOURCE /* See feature_test_macros(7) */ #include int unshare(int flags); uselib - load shared library #include int uselib(const char *library); ustat - get file system statistics #include #include /* libc[45] */ #include /* glibc2 */ int ustat(dev_t dev, struct ustat *ubuf); utime, utimes - change file last access and modification times #include #include int utime(const char *filename, const struct utimbuf *times); #include int utimes(const char *filename, const struct timeval times[2]); utimensat, futimens - change file timestamps with nanosecond precision #include int utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags); int futimens(int fd, const struct timespec times[2]); vfork - create a child process and block parent #include #include pid_t vfork(void); vhangup - virtually hangup the current tty #include int vhangup(void); vm86old, vm86 - enter virtual 8086 mode #include int vm86old(struct vm86_struct *info); int vm86(unsigned long fn, struct vm86plus_struct *v86); vmsplice - splice user pages into a pipe #define _GNU_SOURCE #include #include ssize_t vmsplice(int fd, const struct iovec *iov, unsigned long nr_segs, unsigned int flags); wait, waitpid, waitid - wait for process to change state #include #include pid_t wait(int *status); pid_t waitpid(pid_t pid, int *status, int options); int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options); wait3, wait4 - wait for process to change state, BSD style #include #include #include #include pid_t wait3(int *status, int options, struct rusage *rusage); pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage); write - write to a file descriptor #include ssize_t write(int fd, const void *buf, size_t count); a64l, l64a - convert between long and base-64 #include long a64l(char *str64); char *l64a(long value); abort - cause abnormal process termination #include void abort(void); abs, labs, llabs, imaxabs - compute the absolute value of an integer #include int abs(int j); long int labs(long int j); long long int llabs(long long int j); #include intmax_t imaxabs(intmax_t j); acos, acosf, acosl - arc cosine function #include double acos(double x); float acosf(float x); long double acosl(long double x); Link with -lm. acosh, acoshf, acoshl - inverse hyperbolic cosine function #include double acosh(double x); float acoshf(float x); long double acoshl(long double x); Link with -lm. addseverity - introduce new severity classes #include int addseverity(int severity, const char *s); adjtime - correct the time to synchronize the system clock int adjtime(const struct timeval *delta, struct timeval *olddelta); aio_cancel - cancel an outstanding asynchronous I/O request #include int aio_cancel(int fd, struct aiocb *aiocbp); Link with -lrt. aio_error - get error status of asynchronous I/O operation #include int aio_error(const struct aiocb *aiocbp); Link with -lrt. aio_fsync - asynchronous file synchronization #include int aio_fsync(int op, struct aiocb *aiocbp); Link with -lrt. aio_read - asynchronous read #include int aio_read(struct aiocb *aiocbp); Link with -lrt. aio_return - get return status of asynchronous I/O operation #include ssize_t aio_return(struct aiocb *aiocbp); Link with -lrt. aio_suspend - wait for asynchronous I/O operation or timeout #include int aio_suspend(const struct aiocb * const cblist[], int n, const struct timespec *timeout); Link with -lrt. aio_write - asynchronous write #include int aio_write(struct aiocb *aiocbp); Link with -lrt. alloca - allocate memory that is automatically freed #include void *alloca(size_t size); argz_add, argz_add_sep, argz_append, argz_count, argz_create, argz_cre‐ ate_sep, argz_delete, argz_extract, argz_insert, argz_next, argz_replace, argz_stringify - functions to handle an argz list #include error_t argz_add(char **argz, size_t *argz_len, const char *str); error_t argz_add_sep(char **argz, size_t *argz_len, const char *str, int delim); error_t argz_append(char **argz, size_t *argz_len, const char *buf, size_t buf_len); size_t argz_count(const char *argz, size_t argz_len); error_t argz_create(char * const argv[], char **argz, size_t *argz_len); error_t argz_create_sep(const char *str, int sep, char **argz, size_t *argz_len); error_t argz_delete(char **argz, size_t *argz_len, char *entry); void argz_extract(char *argz, size_t argz_len, char **argv); error_t argz_insert(char **argz, size_t *argz_len, char *before, const char *entry); char *argz_next(char *argz, size_t argz_len, const char *entry); error_t argz_replace(char **argz, size_t *argz_len, const char *str, const char *with, unsigned int *replace_count); void argz_stringify(char *argz, size_t len, int sep); asin, asinf, asinl - arc sine function #include double asin(double x); float asinf(float x); long double asinl(long double x); Link with -lm. asinh, asinhf, asinhl - inverse hyperbolic sine function #include double asinh(double x); float asinhf(float x); long double asinhl(long double x); Link with -lm. asprintf, vasprintf - print to allocated string #define _GNU_SOURCE #include int asprintf(char **strp, const char *fmt, ...); int vasprintf(char **strp, const char *fmt, va_list ap); assert - abort the program if assertion is false #include void assert(scalar expression); assert_perror - test errnum and abort #define _GNU_SOURCE #include void assert_perror(int errnum); atan2, atan2f, atan2l - arc tangent function of two variables #include double atan2(double y, double x); float atan2f(float y, float x); long double atan2l(long double y, long double x); Link with -lm. atan, atanf, atanl - arc tangent function #include double atan(double x); float atanf(float x); long double atanl( long double x); Link with -lm. atanh, atanhf, atanhl - inverse hyperbolic tangent function #include double atanh(double x); float atanhf(float x); long double atanhl(long double x); Link with -lm. atexit - register a function to be called at normal process termination #include int atexit(void (*function)(void)); atof - convert a string to a double #include double atof(const char *nptr); atoi, atol, atoll, atoq - convert a string to an integer #include int atoi(const char *nptr); long atol(const char *nptr); long long atoll(const char *nptr); long long atoq(const char *nptr); backtrace, backtrace_symbols, backtrace_symbols_fd - support for appli‐ cation self-debugging #include int backtrace(void **buffer, int size); char **backtrace_symbols(void *const *buffer, int size); void backtrace_symbols_fd(void *const *buffer, int size, int fd); basename, dirname - parse pathname components #include char *dirname(char *path); char *basename(char *path); bcmp - compare byte sequences #include int bcmp(const void *s1, const void *s2, size_t n); bcopy - copy byte sequence #include void bcopy(const void *src, void *dest, size_t n); bindresvport - bind a socket to a privileged IP port #include #include int bindresvport(int sockfd, struct sockaddr_in *sin); bsd_signal - signal handling with BSD semantics #define _XOPEN_SOURCE #include typedef void (*sighandler_t)(int); sighandler_t bsd_signal(int signum, sighandler_t handler); bsearch - binary search of a sorted array #include void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); bcmp, bcopy, bzero, memccpy, memchr, memcmp, memcpy, memfrob, memmem, memmove, memset - byte string operations #include int bcmp(const void *s1, const void *s2, int n); void bcopy(const void *src, void *dest, int n); void bzero(void *s, int n); void *memccpy(void *dest, const void *src, int c, size_t n); void *memchr(const void *s, int c, size_t n); int memcmp(const void *s1, const void *s2, size_t n); void *memcpy(void *dest, const void *src, size_t n); void *memfrob(void *s, size_t n); void *memmem(const void *needle, size_t needlelen, const void *haystack, size_t haystacklen); void *memmove(void *dest, const void *src, size_t n); void *memset(void *s, int c, size_t n); btowc - convert single byte to wide character #include wint_t btowc(int c); btree - btree database access method #include #include htonl, htons, ntohl, ntohs - convert values between host and network byte order #include uint32_t htonl(uint32_t hostlong); uint16_t htons(uint16_t hostshort); uint32_t ntohl(uint32_t netlong); uint16_t ntohs(uint16_t netshort); bzero - write zero-valued bytes #include void bzero(void *s, size_t n); cabs, cabsf, cabsl - absolute value of a complex number #include double cabs(double complex z); float cabsf(float complex z); long double cabsl(long double complex z); Link with -lm. cacos, cacosf, cacosl - complex arc cosine #include double complex cacos(double complex z); float complex cacosf(float complex z); long double complex cacosl(long double complex z); Link with -lm. cacosh, cacoshf, cacoshl - complex arc hyperbolic cosine #include double complex cacosh(double complex z); float complex cacoshf(float complex z); long double complex cacoshl(long double complex z); Link with -lm. canonicalize_file_name - return the canonicalized filename #define _GNU_SOURCE #include char *canonicalize_file_name(const char *path); carg, cargf, cargl - calculate the argument #include double carg(double complex z); float cargf(float complex z); long double cargl(long double complex z); Link with -lm. casin, casinf, casinl - complex arc sine #include double complex casin(double complex z); float complex casinf(float complex z); long double complex casinl(long double complex z); Link with -lm. casinh, casinhf, casinhl - complex arc sine hyperbolic #include double complex casinh(double complex z); float complex casinhf(float complex z); long double complex casinhl(long double complex z); Link with -lm. catan, catanf, catanl - complex arc tangents #include double complex catan(double complex z); float complex catanf(float complex z); long double complex catanl(long double complex z); Link with -lm. catanh, catanhf, catanhl - complex arc tangents hyperbolic #include double complex catanh(double complex z); float complex catanhf(float complex z); long double complex catanhl(long double complex z); Link with -lm. catgets - get message from a message catalog #include char *catgets(nl_catd catalog, int set_number, int message_number, const char *message); catopen, catclose - open/close a message catalog #include nl_catd catopen(const char *name, int flag); int catclose(nl_catd catalog); cbrt, cbrtf, cbrtl - cube root function #include double cbrt(double x); float cbrtf(float x); long double cbrtl(long double x); Link with -lm. ccos, ccosf, ccosl - complex cosine function #include double complex ccos(double complex z); float complex ccosf(float complex z); long double complex ccosl(long double complex z); Link with -lm. ccosh, ccoshf, ccoshl - complex hyperbolic cosine #include double complex ccosh(double complex z); float complex ccoshf(float complex z); long double complex ccoshl(long double complex z); Link with -lm. ceil, ceilf, ceill - ceiling function: smallest integral value not less than argument #include double ceil(double x); float ceilf(float x); long double ceill(long double x); Link with -lm. cerf, cerff, cerfl, cerfc, cerfcf, cerfcl - complex error function #include double complex cerf(double complex z); float complex cerff(float complex z); long double complex cerfl(long double complex z); double complex cerfc(double complex z); float complex cerfcf(float complex z); long double complex cerfcl(long double complex z); Link with -lm. cexp2, cexp2f, cexp2l - base-2 exponent of a complex number #include double complex cexp2(double complex z); float complex cexp2f(float complex z); long double complex cexp2l(long double complex z); Link with -lm. cexp, cexpf, cexpl - complex exponential function #include double complex cexp(double complex z); float complex cexpf(float complex z); long double complex cexpl(long double complex z); Link with -lm. cfree - free allocated memory #include /* In SunOS 4 */ int cfree(void *ptr); /* In glibc or FreeBSD libcompat */ void cfree(void *ptr); /* In SCO OpenServer */ void cfree(char *ptr, unsigned num, unsigned size); /* In Solaris watchmalloc.so.1 */ void cfree(void *ptr, size_t nelem, size_t elsize); cimag, cimagf, cimagl - get imaginary part of a complex number #include double cimag(double complex z); float cimagf(float complex z); long double cimagl(long double complex z); Link with -lm. clearenv - clear the environment #include int clearenv(void); clock - Determine processor time #include clock_t clock(void); clock_getcpuclockid - obtain ID of a process CPU-time clock #include int clock_getcpuclockid(pid_t pid, clockid_t *clock_id); Link with -lrt. clog10, clog10f, clog10l - base-10 logarithm of a complex number #define _GNU_SOURCE #include double complex clog10(double complex z); float complex clog10f(float complex z); long double complex clog10l(long double complex z); Link with -lm. clog2, clog2f, clog2l - base-2 logarithm of a complex number #include double complex clog2(double complex z); float complex clog2f(float complex z); long double complex clog2l(long double complex z); clog, clogf, clogl - natural logarithm of a complex number #include double complex clog(double complex z); float complex clogf(float complex z); long double complex clogl(long double complex z); Link with -lm. closedir - close a directory #include #include int closedir(DIR *dirp); CMSG_ALIGN, CMSG_SPACE, CMSG_NXTHDR, CMSG_FIRSTHDR - Access ancillary data #include struct cmsghdr *CMSG_FIRSTHDR(struct msghdr *msgh); struct cmsghdr *CMSG_NXTHDR(struct msghdr *msgh, struct cmsghdr *cmsg); size_t CMSG_ALIGN(size_t length); size_t CMSG_SPACE(size_t length); size_t CMSG_LEN(size_t length); unsigned char *CMSG_DATA(struct cmsghdr *cmsg); struct cmsghdr { socklen_t cmsg_len; /* data byte count, including header */ int cmsg_level; /* originating protocol */ int cmsg_type; /* protocol-specific type */ /* followed by unsigned char cmsg_data[]; */ }; confstr - get configuration dependent string variables #include size_t confstr(int name, char *buf, size_t len); conj, conjf, conjl - calculate the complex conjugate #include double complex conj(double complex z); float complex conjf(float complex z); long double complex conjl(long double complex z); Link with -lm. copysign, copysignf, copysignl - copy sign of a number #include double copysign(double x, double y); float copysignf(float x, float y); long double copysignl(long double x, long double y); Link with -lm. cos, cosf, cosl - cosine function #include double cos(double x); float cosf(float x); long double cosl(long double x); Link with -lm. cosh, coshf, coshl - hyperbolic cosine function #include double cosh(double x); float coshf(float x); long double coshl(long double x); Link with -lm. cpow, cpowf, cpowl - complex power function #include double complex cpow(double complex x, complex double z); float complex cpowf(float complex x, complex float z); long double complex cpowl(long double complex x, complex long double z); Link with -lm. cproj, cprojf, cprojl - project into Riemann Sphere #include double complex cproj(double complex z); float complex cprojf(float complex z); long double complex cprojl(long double complex z); Link with -lm. CPU_SET, CPU_CLR, CPU_ISSET, CPU_ZERO, CPU_COUNT, CPU_AND, CPU_OR, CPU_XOR, CPU_EQUAL, CPU_ALLOC, CPU_ALLOC_SIZE, CPU_FREE, CPU_SET_S, CPU_CLR_S, CPU_ISSET_S, CPU_ZERO_S, CPU_COUNT_S, CPU_AND_S, CPU_OR_S, CPU_XOR_S, CPU_EQUAL_S - macros for manipulating CPU sets #define _GNU_SOURCE /* See feature_test_macros(7) */ #include void CPU_ZERO(cpu_set_t *set); void CPU_SET(int cpu, cpu_set_t *set); void CPU_CLR(int cpu, cpu_set_t *set); int CPU_ISSET(int cpu, cpu_set_t *set); int CPU_COUNT(cpu_set_t *set); void CPU_AND(cpu_set_t *destset, cpu_set_t *srcset1, cpu_set_t *srcset2); void CPU_OR(cpu_set_t *destset, cpu_set_t *srcset1, cpu_set_t *srcset2); void CPU_XOR(cpu_set_t *destset, cpu_set_t *srcset1, cpu_set_t *srcset2); int CPU_EQUAL(cpu_set_t *set1, cpu_set_t *set2); cpu_set_t *CPU_ALLOC(int num_cpus); void CPU_FREE(cpu_set_t *set); size_t CPU_ALLOC_SIZE(int num_cpus); void CPU_ZERO_S(size_t setsize, cpu_set_t *set); void CPU_SET_S(int cpu, size_t setsize, cpu_set_t *set); void CPU_CLR_S(int cpu, size_t setsize, cpu_set_t *set); int CPU_ISSET_S(int cpu, size_t setsize, cpu_set_t *set); int CPU_COUNT_S(size_t setsize, cpu_set_t *set); void CPU_AND_S(size_t setsize, cpu_set_t *destset, cpu_set_t *srcset1, cpu_set_t *srcset2); void CPU_OR_S(size_t setsize, cpu_set_t *destset, cpu_set_t *srcset1, cpu_set_t *srcset2); void CPU_XOR_S(size_t setsize, cpu_set_t *destset, cpu_set_t *srcset1, cpu_set_t *srcset2); int CPU_EQUAL_S(size_t setsize, cpu_set_t *set1, cpu_set_t *set2); creal, crealf, creall - get real part of a complex number #include double creal(double complex z); float crealf(float complex z); long double creall(long double complex z); Link with -lm. crypt, crypt_r - password and data encryption #define _XOPEN_SOURCE #include char *crypt(const char *key, const char *salt); char *crypt_r(const char *key, const char *salt, struct crypt_data *data); Link with -lcrypt. csin, csinf, csinl - complex sine function #include double complex csin(double complex z); float complex csinf(float complex z); long double complex csinl(long double complex z); Link with -lm. csinh, csinhf, csinhl - complex hyperbolic sine #include double complex csinh(double complex z); float complex csinhf(float complex z); long double complex csinhl(long double complex z); Link with -lm. csqrt, csqrtf, csqrtl - complex square root #include double complex csqrt(double complex z); float complex csqrtf(float complex z); long double complex csqrtl(long double complex z); Link with -lm. ctan, ctanf, ctanl - complex tangent function #include double complex ctan(double complex z); float complex ctanf(float complex z); long double complex ctanl(long double complex z); Link with -lm. ctanh, ctanhf, ctanhl - complex hyperbolic tangent #include double complex ctanh(double complex z); float complex ctanhf(float complex z); long double complex ctanhl(long double complex z); Link with -lm. ctermid - get controlling terminal name #include char *ctermid(char *s); asctime, ctime, gmtime, localtime, mktime, asctime_r, ctime_r, gmtime_r, localtime_r - transform date and time to broken-down time or ASCII #include char *asctime(const struct tm *tm); char *asctime_r(const struct tm *tm, char *buf); char *ctime(const time_t *timep); char *ctime_r(const time_t *timep, char *buf); struct tm *gmtime(const time_t *timep); struct tm *gmtime_r(const time_t *timep, struct tm *result); struct tm *localtime(const time_t *timep); struct tm *localtime_r(const time_t *timep, struct tm *result); time_t mktime(struct tm *tm); daemon - run in the background #include int daemon(int nochdir, int noclose); dbopen - database access methods #include #include #include #include DB *dbopen(const char *file, int flags, int mode, DBTYPE type, const void *openinfo); des_crypt, ecb_crypt, cbc_crypt, des_setparity, DES_FAILED - fast DES encryption #include int ecb_crypt(char *key, char *data, unsigned datalen, unsigned mode); int cbc_crypt(char *key, char *data, unsigned datalen, unsigned mode, char *ivec); void des_setparity(char *key); int DES_FAILED(int status); difftime - calculate time difference #include double difftime(time_t time1, time_t time0); dirfd - get directory stream file descriptor #include #include int dirfd(DIR *dirp); div, ldiv, lldiv, imaxdiv - compute quotient and remainder of an inte‐ ger division #include div_t div(int numerator, int denominator); ldiv_t ldiv(long numerator, long denominator); lldiv_t lldiv(long long numerator, long long denominator); #include imaxdiv_t imaxdiv(intmax_t numerator, intmax_t denominator); dl_iterate_phdr - walk through list of shared objects #define _GNU_SOURCE #include int dl_iterate_phdr( int (*callback) (struct dl_phdr_info *info, size_t size, void *data), void *data); dladdr, dlclose, dlerror, dlopen, dlsym, dlvsym - programming interface to dynamic linking loader #include void *dlopen(const char *filename, int flag); char *dlerror(void); void *dlsym(void *handle, const char *symbol); int dlclose(void *handle); Link with -ldl. dprintf, vdprintf - print to a file descriptor #include int dprintf(int fd, const char *format, ...); int vdprintf(int fd, const char *format, va_list ap); drand48, erand48, lrand48, nrand48, mrand48, jrand48, srand48, seed48, lcong48 - generate uniformly distributed pseudo-random numbers #include double drand48(void); double erand48(unsigned short xsubi[3]); long int lrand48(void); long int nrand48(unsigned short xsubi[3]); long int mrand48(void); long int jrand48(unsigned short xsubi[3]); void srand48(long int seedval); unsigned short *seed48(unsigned short seed16v[3]); void lcong48(unsigned short param[7]); drand48_r, erand48_r, lrand48_r, nrand48_r, mrand48_r, jrand48_r, srand48_r, seed48_r, lcong48_r - generate uniformly distributed pseudo- random numbers reentrantly #include int drand48_r(struct drand48_data *buffer, double *result); int erand48_r(unsigned short xsubi[3], struct drand48_data *buffer, double *result); int lrand48_r(struct drand48_data *buffer, long int *result); int nrand48_r(unsigned short int xsubi[3], struct drand48_data *buffer, long int *result); int mrand48_r(struct drand48_data *buffer,long int *result); int jrand48_r(unsigned short int xsubi[3], struct drand48_data *buffer, long int *result); int srand48_r(long int seedval, struct drand48_data *buffer); int seed48_r(unsigned short int seed16v[3], struct drand48_data *buffer); int lcong48_r(unsigned short int param[7], struct drand48_data *buffer); dysize - get number of days for a given year #include int dysize(int year); ecvt, fcvt - convert a floating-point number to a string #include char *ecvt(double number, int ndigits, int *decpt, int *sign); char *fcvt(double number, int ndigits, int *decpt, int *sign); ecvt_r, fcvt_r, qecvt_r, qfcvt_r - convert a floating-point number to a string #include int ecvt_r(double number, int ndigits, int *decpt, int *sign, char *buf, size_t len); int fcvt_r(double number, int ndigits, int *decpt, int *sign, char *buf, size_t len); int qecvt_r(long double number, int ndigits, int *decpt, int *sign, char *buf, size_t len); int qfcvt_r(long double number, int ndigits, int *decpt, int *sign, char *buf, size_t len); encrypt, setkey, encrypt_r, setkey_r - encrypt 64-bit messages #define _XOPEN_SOURCE #include void encrypt(char block[64], int edflag); #define _XOPEN_SOURCE #include void setkey(const char *key); #define _GNU_SOURCE #include void setkey_r(const char *key, struct crypt_data *data); void encrypt_r(char *block, int edflag, struct crypt_data *data); Each of these requires linking with -lcrypt. etext, edata, end - end of program segments extern etext; extern edata; extern end; htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh - convert values between host and big-/little-endian byte order #define _BSD_SOURCE /* See feature_test_macros(7) */ #include uint16_t htobe16(uint16_t host_16bits); uint16_t htole16(uint16_t host_16bits); uint16_t be16toh(uint16_t big_endian_16bits); uint16_t le16toh(uint16_t little_endian_16bits); uint32_t htobe32(uint32_t host_32bits); uint32_t htole32(uint32_t host_32bits); uint32_t be32toh(uint32_t big_endian_32bits); uint32_t le32toh(uint32_t little_endian_32bits); uint64_t htobe64(uint64_t host_64bits); uint64_t htole64(uint64_t host_64bits); uint64_t be64toh(uint64_t big_endian_64bits); uint64_t le64toh(uint64_t little_endian_64bits); envz_add, envz_entry, envz_get, envz_merge, envz_remove, envz_strip - environment string support #include error_t envz_add(char **envz, size_t *envz_len, const char *name, const char *value); char *envz_entry(const char *envz, size_t *envz_len, const char *name); char *envz_get(const char *envz, size_t *envz_len, const char *name); error_t envz_merge(char **envz, size_t *envz_len, const char *envz2, size_t envz2_len, int override); void envz_remove(char **envz, size_t *envz_len, const char *name); void envz_strip(char **envz, size_t *envz_len); erf, erff, erfl, - error function #include double erf(double x); float erff(float x); long double erfl(long double x); Link with -lm. erfc, erfcf, erfcl - complementary error function #include double erfc(double x); float erfcf(float x); long double erfcl(long double x); Link with -lm. err, verr, errx, verrx, warn, vwarn, warnx, vwarnx - formatted error messages #include void err(int eval, const char *fmt, ...); void errx(int eval, const char *fmt, ...); void warn(const char *fmt, ...); void warnx(const char *fmt, ...); #include void verr(int eval, const char *fmt, va_list args); void verrx(int eval, const char *fmt, va_list args); void vwarn(const char *fmt, va_list args); void vwarnx(const char *fmt, va_list args); errno - number of last error #include error, error_at_line, error_message_count, error_on_per_line, error_print_progname - glibc error reporting functions #include void error(int status, int errnum, const char *format, ...); void error_at_line(int status, int errnum, const char *filename, unsigned int linenum, const char *format, ...); extern unsigned int error_message_count; extern int error_one_per_line; extern void (* error_print_progname) (void); ether_aton, ether_ntoa, ether_ntohost, ether_hostton, ether_line, ether_ntoa_r, ether_aton_r - Ethernet address manipulation routines #include char *ether_ntoa(const struct ether_addr *addr); struct ether_addr *ether_aton(const char *asc); int ether_ntohost(char *hostname, const struct ether_addr *addr); int ether_hostton(const char *hostname, struct ether_addr *addr); int ether_line(const char *line, struct ether_addr *addr, char *hostname); /* GNU extensions */ char *ether_ntoa_r(const struct ether_addr *addr, char *buf); struct ether_addr *ether_aton_r(const char *asc, struct ether_addr *addr); euidaccess, eaccess - check effective user's permissions for a file #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int euidaccess(const char *pathname, int mode); int eaccess(const char *pathname, int mode); execl, execlp, execle, execv, execvp - execute a file #include extern char **environ; int execl(const char *path, const char *arg, ...); int execlp(const char *file, const char *arg, ...); int execle(const char *path, const char *arg, ..., char * const envp[]); int execv(const char *path, char *const argv[]); int execvp(const char *file, char *const argv[]); exit - cause normal process termination #include void exit(int status); exp10, exp10f, exp10l - base-10 exponential function #define _GNU_SOURCE #include double exp10(double x); float exp10f(float x); long double exp10l(long double x); Link with -lm. exp2, exp2f, exp2l - base-2 exponential function #include double exp2(double x); float exp2f(float x); long double exp2l(long double x); Link with -lm. exp, expf, expl - base-e exponential function #include double exp(double x); float expf(float x); long double expl(long double x); Link with -lm. expm1, expm1f, expm1l - exponential minus 1 #include double expm1(double x); float expm1f(float x); long double expm1l(long double x); Link with -lm. fabs, fabsf, fabsl - absolute value of floating-point number #include double fabs(double x); float fabsf(float x); long double fabsl(long double x); Link with -lm. fclose - close a stream #include int fclose(FILE *fp); fcloseall - close all open streams #define _GNU_SOURCE #include int fcloseall(void); fdim, fdimf, fdiml - positive difference #include double fdim(double x, double y); float fdimf(float x, float y); long double fdiml(long double x, long double y); Link with -lm. feclearexcept, fegetexceptflag, feraiseexcept, fesetexceptflag, fetes‐ texcept, fegetenv, fegetround, feholdexcept, fesetround, fesetenv, feupdateenv, feenableexcept, fedisableexcept, fegetexcept - floating- point rounding and exception handling #include int feclearexcept(int excepts); int fegetexceptflag(fexcept_t *flagp, int excepts); int feraiseexcept(int excepts); int fesetexceptflag(const fexcept_t *flagp, int excepts); int fetestexcept(int excepts); int fegetround(void); int fesetround(int rounding_mode); int fegetenv(fenv_t *envp); int feholdexcept(fenv_t *envp); int fesetenv(const fenv_t *envp); int feupdateenv(const fenv_t *envp); Link with -lm. clearerr, feof, ferror, fileno - check and reset stream status #include void clearerr(FILE *stream); int feof(FILE *stream); int ferror(FILE *stream); int fileno(FILE *stream); fexecve - execute program specified via file descriptor #include int fexecve(int fd, char *const argv[], char *const envp[]); fflush - flush a stream #include int fflush(FILE *stream); ffs, ffsl, ffsll - find first bit set in a word #include int ffs(int i); #include int ffsl(long int i); int ffsll(long long int i); fgetgrent - get group file entry #include #include #include struct group *fgetgrent(FILE *stream); fgetpwent - get password file entry #include #include #include struct passwd *fgetpwent(FILE *stream); fgetwc, getwc - read a wide character from a FILE stream #include #include wint_t fgetwc(FILE *stream); wint_t getwc(FILE *stream); fgetws - read a wide-character string from a FILE stream #include wchar_t *fgetws(wchar_t *ws, int n, FILE *stream); finite, finitef, finitel, isinf, isinff, isinfl, isnan, isnanf, isnanl - BSD floating-point classification functions #include int finite(double x); int finitef(float x); int finitel(long double x); int isinf(double x); int isinff(float x); int isinfl(long double x); int isnan(double x); int isnanf(float x); int isnanl(long double x); flockfile, ftrylockfile, funlockfile - lock FILE for stdio #include void flockfile(FILE *filehandle); int ftrylockfile(FILE *filehandle); void funlockfile(FILE *filehandle); floor, floorf, floorl - largest integral value not greater than argu‐ ment #include double floor(double x); float floorf(float x); long double floorl(long double x); Link with -lm. fma, fmaf, fmal - floating-point multiply and add #include double fma(double x, double y, double z); float fmaf(float x, float y, float z); long double fmal(long double x, long double y, long double z); Link with -lm. fmax, fmaxf, fmaxl - determine maximum of two floating-point numbers #include double fmax(double x, double y); float fmaxf(float x, float y); long double fmaxl(long double x, long double y); Link with -lm. fmemopen, open_memstream, open_wmemstream - open memory as stream #include FILE *fmemopen(void *buf, size_t size, const char *mode); FILE *open_memstream(char **ptr, size_t *sizeloc); #include FILE *open_wmemstream(wchar_t **ptr, size_t *sizeloc); fmin, fminf, fminl - determine minimum of two floating-point numbers #include double fmin(double x, double y); float fminf(float x, float y); long double fminl(long double x, long double y); Link with -lm. fmod, fmodf, fmodl - floating-point remainder function #include double fmod(double x, double y); float fmodf(float x, float y); long double fmodl(long double x, long double y); Link with -lm. fmtmsg - print formatted error messages #include int fmtmsg(long classification, const char *label, int severity, const char *text, const char *action, const char *tag); fnmatch - match filename or pathname #include int fnmatch(const char *pattern, const char *string, int flags); fopen, fdopen, freopen - stream open functions #include FILE *fopen(const char *path, const char *mode); FILE *fdopen(int fd, const char *mode); FILE *freopen(const char *path, const char *mode, FILE *stream); fopencookie - opening a custom stream #define _GNU_SOURCE #include FILE *fopencookie(void *cookie, const char *mode, cookie_io_functions_t io_funcs); fpathconf, pathconf - get configuration values for files #include long fpathconf(int fd, int name); long pathconf(char *path, int name); fpclassify, isfinite, isnormal, isnan, isinf - floating-point classifi‐ cation macros #include int fpclassify(x); int isfinite(x); int isnormal(x); int isnan(x); int isinf(x); Link with -lm. fpurge, __fpurge - purge a stream /* unsupported */ #include int fpurge(FILE *stream); /* supported */ #include #include void __fpurge(FILE *stream); fputwc, putwc - write a wide character to a FILE stream #include #include wint_t fputwc(wchar_t wc, FILE *stream); wint_t putwc(wchar_t wc, FILE *stream); fputws - write a wide-character string to a FILE stream #include int fputws(const wchar_t *ws, FILE *stream); fread, fwrite - binary stream input/output #include size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); frexp, frexpf, frexpl - convert floating-point number to fractional and integral components #include double frexp(double x, int *exp); float frexpf(float x, int *exp); long double frexpl(long double x, int *exp); Link with -lm. fgetpos, fseek, fsetpos, ftell, rewind - reposition a stream #include int fseek(FILE *stream, long offset, int whence); long ftell(FILE *stream); void rewind(FILE *stream); int fgetpos(FILE *stream, fpos_t *pos); int fsetpos(FILE *stream, fpos_t *pos); fseeko, ftello - seek to or report file position #include int fseeko(FILE *stream, off_t offset, int whence); off_t ftello(FILE *stream); ftime - return date and time #include int ftime(struct timeb *tp); ftok - convert a pathname and a project identifier to a System V IPC key #include #include key_t ftok(const char *pathname, int proj_id); fts, fts_open, fts_read, fts_children, fts_set, fts_close - traverse a file hierarchy #include #include #include FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **)); FTSENT *fts_read(FTS *ftsp); FTSENT *fts_children(FTS *ftsp, int options); int fts_set(FTS *ftsp, FTSENT *f, int options); int fts_close(FTS *ftsp); ftw, nftw - file tree walk #include int ftw(const char *dirpath, int (*fn) (const char *fpath, const struct stat *sb, int typeflag), int nopenfd); #define _XOPEN_SOURCE 500 #include int nftw(const char *dirpath, int (*fn) (const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf), int nopenfd, int flags); futimes, lutimes - change file timestamps #include int futimes(int fd, const struct timeval tv[2]); int lutimes(const char *filename, const struct timeval tv[2]); fwide - set and determine the orientation of a FILE stream #include int fwide(FILE *stream, int mode); gamma, gammaf, gammal - (logarithm of the) gamma function #include double gamma(double x); float gammaf(float x); long double gammal(long double x); Link with -lm. gcvt - convert a floating-point number to a string #include char *gcvt(double number, size_t ndigit, char *buf); getaddrinfo, freeaddrinfo, gai_strerror - network address and service translation #include #include #include int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res); void freeaddrinfo(struct addrinfo *res); const char *gai_strerror(int errcode); getcwd, getwd, get_current_dir_name - Get current working directory #include char *getcwd(char *buf, size_t size); char *getwd(char *buf); char *get_current_dir_name(void); getdate, getdate_r - convert a date-plus-time string to broken-down time #include struct tm *getdate(const char *string); extern int getdate_err; #include int getdate_r(const char *string, struct tm *res); getdirentries - get directory entries in a file system-independent for‐ mat #include ssize_t getdirentries(int fd, char *buf, size_t nbytes , off_t *basep); getenv - get an environment variable #include char *getenv(const char *name); getfsent, getfsspec, getfsfile, setfsent, endfsent - handle fstab entries #include void endfsent(void); struct fstab *getfsent(void); struct fstab *getfsfile(const char *mount_point); struct fstab *getfsspec(const char *special_file); int setfsent(void); getgrent, setgrent, endgrent - get group file entry #include #include struct group *getgrent(void); void setgrent(void); void endgrent(void); getgrent_r, fgetgrent_r - get group file entry reentrantly #include int getgrent_r(struct group *gbuf, char *buf, size_t buflen, struct group **gbufp); int fgetgrent_r(FILE *fp, struct group *gbuf, char *buf, size_t buflen, struct group **gbufp); getgrnam, getgrnam_r, getgrgid, getgrgid_r - get group file entry #include #include struct group *getgrnam(const char *name); struct group *getgrgid(gid_t gid); int getgrnam_r(const char *name, struct group *grp, char *buf, size_t buflen, struct group **result); int getgrgid_r(gid_t gid, struct group *grp, char *buf, size_t buflen, struct group **result); getgrouplist - get list of groups to which a user belongs #include int getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups); gethostbyname, gethostbyaddr, sethostent, gethostent, endhostent, h_errno, herror, hstrerror, gethostbyaddr_r, gethostbyname2, gethostby‐ name2_r, gethostbyname_r, gethostent_r - get network host entry #include extern int h_errno; struct hostent *gethostbyname(const char *name); #include /* for AF_INET */ struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type); void sethostent(int stayopen); void endhostent(void); void herror(const char *s); const char *hstrerror(int err); /* System V/POSIX extension */ struct hostent *gethostent(void); /* GNU extensions */ struct hostent *gethostbyname2(const char *name, int af); int gethostent_r( struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop); int gethostbyaddr_r(const void *addr, socklen_t len, int type, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop); int gethostbyname_r(const char *name, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop); int gethostbyname2_r(const char *name, int af, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop); gethostid, sethostid - get or set the unique identifier of the current host #include long gethostid(void); int sethostid(long hostid); getifaddrs, freeifaddrs - get interface addresses #include #include int getifaddrs(struct ifaddrs **ifap); void freeifaddrs(struct ifaddrs *ifa); getipnodebyname, getipnodebyaddr, freehostent - get network hostnames and addresses #include #include #include struct hostent *getipnodebyname(const char *name, int af, int flags, int *error_num); struct hostent *getipnodebyaddr(const void *addr, size_t len, int af, int *error_num); void freehostent(struct hostent *ip); getline, getdelim - delimited string input #include ssize_t getline(char **lineptr, size_t *n, FILE *stream); ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream); getloadavg - get system load averages #define _BSD_SOURCE #include int getloadavg(double loadavg[], int nelem); getlogin, getlogin_r, cuserid - get username #include char *getlogin(void); int getlogin_r(char *buf, size_t bufsize); #include char *cuserid(char *string); getmntent, setmntent, addmntent, endmntent, hasmntopt, getmntent_r - get file system descriptor file entry #include #include FILE *setmntent(const char *filename, const char *type); struct mntent *getmntent(FILE *fp); int addmntent(FILE *fp, const struct mntent *mnt); int endmntent(FILE *fp); char *hasmntopt(const struct mntent *mnt, const char *opt); /* GNU extension */ #include struct mntent *getmntent_r(FILE *fp, struct mntent *mntbuf, char *buf, int buflen); getnameinfo - address-to-name translation in protocol-independent man‐ ner #include #include int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags); getnetent, getnetbyname, getnetbyaddr, setnetent, endnetent - get net‐ work entry #include struct netent *getnetent(void); struct netent *getnetbyname(const char *name); struct netent *getnetbyaddr(uint32_t net, int type); void setnetent(int stayopen); void endnetent(void); getnetent_r, getnetbyname_r, getnetbyaddr_r - get network entry (reen‐ trant) #include int getnetent_r(struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop); int getnetbyname_r(const char *name, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop); int getnetbyaddr_r(uint32_t net, int type, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop); getopt, getopt_long, getopt_long_only, optarg, optind, opterr, optopt - Parse command-line options #include int getopt(int argc, char * const argv[], const char *optstring); extern char *optarg; extern int optind, opterr, optopt; #include int getopt_long(int argc, char * const argv[], const char *optstring, const struct option *longopts, int *longindex); int getopt_long_only(int argc, char * const argv[], const char *optstring, const struct option *longopts, int *longindex); getpass - get a password #include char *getpass( const char *prompt); getprotoent, getprotobyname, getprotobynumber, setprotoent, endprotoent - get protocol entry #include struct protoent *getprotoent(void); struct protoent *getprotobyname(const char *name); struct protoent *getprotobynumber(int proto); void setprotoent(int stayopen); void endprotoent(void); getprotoent_r, getprotobyname_r, getprotobynumber_r - get protocol entry (reentrant) #include int getprotoent_r(struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result); int getprotobyname_r(const char *name, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result); int getprotobynumber_r(int proto, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result); getpt - open the pseudo-terminal master (PTM) #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int getpt(void); getpw - Re-construct password line entry #define _GNU_SOURCE /* See feature_test_macros(7) */ #include #include int getpw(uid_t uid, char *buf); getpwent, setpwent, endpwent - get password file entry #include #include struct passwd *getpwent(void); void setpwent(void); void endpwent(void); getpwent_r, fgetpwent_r - get passwd file entry reentrantly #include int getpwent_r(struct passwd *pwbuf, char *buf, size_t buflen, struct passwd **pwbufp); int fgetpwent_r(FILE *fp, struct passwd *pwbuf, char *buf, size_t buflen, struct passwd **pwbufp); getpwnam, getpwnam_r, getpwuid, getpwuid_r - get password file entry #include #include struct passwd *getpwnam(const char *name); struct passwd *getpwuid(uid_t uid); int getpwnam_r(const char *name, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result); int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result); getrpcent, getrpcbyname, getrpcbynumber, setrpcent, endrpcent - get RPC entry #include struct rpcent *getrpcent(void); struct rpcent *getrpcbyname(char *name); struct rpcent *getrpcbynumber(int number); void setrpcent(int stayopen); void endrpcent(void); getrpcent_r, getrpcbyname_r, getrpcbynumber_r - get RPC entry (reen‐ trant) #include int getrpcent_r(struct rpcent *result_buf, char *buf, size_t buflen, struct rpcent **result); int getrpcbyname_r(const char *name, struct rpcent *result_buf, char *buf, size_t buflen, struct rpcent **result); int getrpcbynumber_r(int number, struct rpcent *result_buf, char *buf, size_t buflen, struct rpcent **result); getrpcport - get RPC port number int getrpcport(char *host, int prognum, int versnum, int proto); fgetc, fgets, getc, getchar, gets, ungetc - input of characters and strings #include int fgetc(FILE *stream); char *fgets(char *s, int size, FILE *stream); int getc(FILE *stream); int getchar(void); char *gets(char *s); int ungetc(int c, FILE *stream); getservent, getservbyname, getservbyport, setservent, endservent - get service entry #include struct servent *getservent(void); struct servent *getservbyname(const char *name, const char *proto); struct servent *getservbyport(int port, const char *proto); void setservent(int stayopen); void endservent(void); getservent_r, getservbyname_r, getservbyport_r - get service entry (reentrant) #include int getservent_r(struct servent *result_buf, char *buf, size_t buflen, struct servent **result); int getservbyname_r(const char *name, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result); int getservbyport_r(int port, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result); getspnam, getspnam_r, getspent, getspent_r, setspent, endspent, fget‐ spent, fgetspent_r, sgetspent, sgetspent_r, putspent, lckpwdf, ulckpwdf - get shadow password file entry /* General shadow password file API */ #include struct spwd *getspnam(const char *name); struct spwd *getspent(void); void setspent(void); void endspent(void); struct spwd *fgetspent(FILE *fp); struct spwd *sgetspent(const char *s); int putspent(struct spwd *p, FILE *fp); int lckpwdf(void); int ulckpwdf(void); /* GNU extension */ #include int getspent_r(struct spwd *spbuf, char *buf, size_t buflen, struct spwd **spbufp); int getspnam_r(const char *name, struct spwd *spbuf, char *buf, size_t buflen, struct spwd **spbufp); int fgetspent_r(FILE *fp, struct spwd *spbuf, char *buf, size_t buflen, struct spwd **spbufp); int sgetspent_r(const char *s, struct spwd *spbuf, char *buf, size_t buflen, struct spwd **spbufp); getsubopt - parse suboption arguments from a string #include int getsubopt(char **optionp, char * const *tokens, char **valuep); getttyent, getttynam, setttyent, endttyent - get ttys file entry #include struct ttyent *getttyent(void); struct ttyent *getttynam(const char *name); int setttyent(void); int endttyent(void); getumask - get file creation mask #define _GNU_SOURCE /* See feature_test_macros(7) */ #include #include mode_t getumask(void); getusershell, setusershell, endusershell - get permitted user shells #include char *getusershell(void); void setusershell(void); void endusershell(void); getutent, getutid, getutline, pututline, setutent, endutent, utmpname - access utmp file entries #include struct utmp *getutent(void); struct utmp *getutid(struct utmp *ut); struct utmp *getutline(struct utmp *ut); struct utmp *pututline(struct utmp *ut); void setutent(void); void endutent(void); int utmpname(const char *file); getutmp, getutmpx - copy utmp structure to utmpx, and vice versa #define _GNU_SOURCE /* See feature_test_macros(7) */ #include void getutmp(const struct utmpx *ux, struct utmp *u); void getutmpx(const struct utmp *u, struct utmpx *ux); getw, putw - input and output of words (ints) #include int getw(FILE *stream); int putw(int w, FILE *stream); getwchar - read a wide character from standard input #include wint_t getwchar(void); glob, globfree - find pathnames matching a pattern, free memory from glob() #include int glob(const char *pattern, int flags, int (*errfunc) (const char *epath, int eerrno), glob_t *pglob); void globfree(glob_t *pglob); gnu_get_libc_version, gnu_get_libc_release - get glibc version and release #define _GNU_SOURCE /* See feature_test_macros(7) */ #include const char *gnu_get_libc_version(void); const char *gnu_get_libc_release(void); grantpt - grant access to the slave pseudo-terminal #define _XOPEN_SOURCE #include int grantpt(int fd); gsignal, ssignal - software signal facility #include typedef void (*sighandler_t)(int); int gsignal(intsignum); sighandler_t ssignal(int signum, sighandler_t action); hash - hash database access method #include #include hcreate, hdestroy, hsearch, hcreate_r, hdestroy_r, hsearch_r - hash ta‐ ble management #include int hcreate(size_t nel); ENTRY *hsearch(ENTRY item, ACTION action); void hdestroy(void); #define _GNU_SOURCE #include int hcreate_r(size_t nel, struct hsearch_data *htab); int hsearch_r(ENTRY item, ACTION action, ENTRY **retval, struct hsearch_data *htab); void hdestroy_r(struct hsearch_data *htab); hypot, hypotf, hypotl - Euclidean distance function #include double hypot(double x, double y); float hypotf(float x, float y); long double hypotl(long double x, long double y); Link with -lm. iconv - perform character set conversion #include size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); iconv_close - deallocate descriptor for character set conversion #include int iconv_close(iconv_t cd); iconv_open - allocate descriptor for character set conversion #include iconv_t iconv_open(const char *tocode, const char *fromcode); ilogb, ilogbf, ilogbl - get integer exponent of a floating-point value #include int ilogb(double x); int ilogbf(float x); int ilogbl(long double x); Link with -lm. index, rindex - locate character in string #include char *index(const char *s, int c); char *rindex(const char *s, int c); inet_aton, inet_addr, inet_network, inet_ntoa, inet_makeaddr, inet_lnaof, inet_netof - Internet address manipulation routines #include #include #include int inet_aton(const char *cp, struct in_addr *inp); in_addr_t inet_addr(const char *cp); in_addr_t inet_network(const char *cp); char *inet_ntoa(struct in_addr in); struct in_addr inet_makeaddr(int net, int host); in_addr_t inet_lnaof(struct in_addr in); in_addr_t inet_netof(struct in_addr in); inet_ntop - convert IPv4 and IPv6 addresses from binary to text form #include const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); inet_pton - convert IPv4 and IPv6 addresses from text to binary form #include int inet_pton(int af, const char *src, void *dst); INFINITY, NAN, HUGE_VAL, HUGE_VALF, HUGE_VALL - floating-point con‐ stants #define _ISOC99_SOURCE #include INFINITY NAN HUGE_VAL HUGE_VALF HUGE_VALL initgroups - initialize the supplementary group access list #include #include int initgroups(const char *user, gid_t group); insque, remque - insert/remove an item from a queue #include void insque(void *elem, void *prev); void remque(void *elem); isalnum, isalpha, isascii, isblank, iscntrl, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit - character classification routines #include int isalnum(int c); int isalpha(int c); int isascii(int c); int isblank(int c); int iscntrl(int c); int isdigit(int c); int isgraph(int c); int islower(int c); int isprint(int c); int ispunct(int c); int isspace(int c); int isupper(int c); int isxdigit(int c); isatty - test whether a file descriptor refers to a terminal #include int isatty(int fd); isgreater, isgreaterequal, isless, islessequal, islessgreater, isunordered - floating-point relational tests without exception for NaN #include int isgreater(x, y); int isgreaterequal(x, y); int isless(x, y); int islessequal(x, y); int islessgreater(x, y); int isunordered(x, y); Link with -lm. iswalnum - test for alphanumeric wide character #include int iswalnum(wint_t wc); iswalpha - test for alphabetic wide character #include int iswalpha(wint_t wc); iswblank - test for whitespace wide character #include int iswblank(wint_t wc); iswcntrl - test for control wide character #include int iswcntrl(wint_t wc); iswctype - wide-character classification #include int iswctype(wint_t wc, wctype_t desc); iswdigit - test for decimal digit wide character #include int iswdigit(wint_t wc); iswgraph - test for graphic wide character #include int iswgraph(wint_t wc); iswlower - test for lowercase wide character #include int iswlower(wint_t wc); iswprint - test for printing wide character #include int iswprint(wint_t wc); iswpunct - test for punctuation or symbolic wide character #include int iswpunct(wint_t wc); iswspace - test for whitespace wide character #include int iswspace(wint_t wc); iswupper - test for uppercase wide character #include int iswupper(wint_t wc); iswxdigit - test for hexadecimal digit wide character #include int iswxdigit(wint_t wc); j0, j0f, j0l, j1, j1f, j1l, jn, jnf, jnl - Bessel functions of the first kind #include double j0(double x); double j1(double x); double jn(int n, double x); float j0f(float x); float j1f(float x); float jnf(int n, float x); long double j0l(long double x); long double j1l(long double x); long double jnl(int n, long double x); Link with -lm. key_decryptsession, key_encryptsession, key_setsecret, key_gendes, key_secretkey_is_set - interfaces to rpc keyserver daemon #include int key_decryptsession(const char *remotename, des_block *deskey); int key_encryptsession(const char *remotename, des_block *deskey); int key_gendes(des_block *deskey); int key_setsecret(const char *key); int key_secretkey_is_set(void); ldexp, ldexpf, ldexpl - multiply floating-point number by integral power of 2 #include double ldexp(double x, int exp); float ldexpf(float x, int exp); long double ldexpl(long double x, int exp); Link with -lm. lgamma, lgammaf, lgammal, lgamma_r, lgammaf_r, lgammal_r, signgam - log gamma function #include double lgamma(double x); float lgammaf(float x); long double lgammal(long double x); double lgamma_r(double x, int *signp); float lgammaf_r(float x, int *signp); long double lgammal_r(long double x, int *signp); extern int signgam; Link with -lm. localeconv - get numeric formatting information #include struct lconv *localeconv(void); lockf - apply, test or remove a POSIX lock on an open file #include int lockf(int fd, int cmd, off_t len); log10, log10f, log10l - base-10 logarithmic function #include double log10(double x); float log10f(float x); long double log10l(long double x); Link with -lm. log1p, log1pf, log1pl - logarithm of 1 plus argument #include double log1p(double x); float log1pf(float x); long double log1pl(long double x); Link with -lm. log2, log2f, log2l - base-2 logarithmic function #include double log2(double x); float log2f(float x); long double log2l(long double x); Link with -lm. log, logf, logl - natural logarithmic function #include double log(double x); float logf(float x); long double logl(long double x); Link with -lm. logb, logbf, logbl - get exponent of a floating-point value #include double logb(double x); float logbf(float x); long double logbl(long double x); Link with -lm. login, logout - write utmp and wtmp entries #include void login(const struct utmp *ut); int logout(const char *ut_line); Link with -lutil. longjmp, siglongjmp - nonlocal jump to a saved stack context #include void longjmp(jmp_buf env, int val); void siglongjmp(sigjmp_buf env, int val); lrint, lrintf, lrintl, llrint, llrintf, llrintl - round to nearest integer #include long int lrint(double x); long int lrintf(float x); long int lrintl(long double x); long long int llrint(double x); long long int llrintf(float x); long long int llrintl(long double x); Link with -lm. lround, lroundf, lroundl, llround, llroundf, llroundl - round to near‐ est integer, away from zero #include long int lround(double x); long int lroundf(float x); long int lroundl(long double x); long long int llround(double x); long long int llroundf(float x); long long int llroundl(long double x); Link with -lm. lfind, lsearch - linear search of an array #include void *lfind(const void *key, const void *base, size_t *nmemb, size_t size, int(*compar)(const void *, const void *)); void *lsearch(const void *key, void *base, size_t *nmemb, size_t size, int(*compar)(const void *, const void *)); lseek64 - reposition 64-bit read/write file offset #define _LARGEFILE64_SOURCE #include #include off64_t lseek64(int fd, off64_t offset, int whence); makecontext, swapcontext - manipulate user context #include void makecontext(ucontext_t *ucp, void (*func)(), int argc, ...); int swapcontext(ucontext_t *oucp, ucontext_t *ucp); makedev, major, minor - manage a device number #define _BSD_SOURCE /* See feature_test_macros(7) */ #include dev_t makedev(int maj, int min); int major(dev_t dev); int minor(dev_t dev); calloc, malloc, free, realloc - Allocate and free dynamic memory #include void *calloc(size_t nmemb, size_t size); void *malloc(size_t size); void free(void *ptr); void *realloc(void *ptr, size_t size); __malloc_hook, __malloc_initialize_hook, __memalign_hook, __free_hook, __realloc_hook, __after_morecore_hook - malloc debugging variables #include void *(*__malloc_hook)(size_t size, const void *caller); void *(*__realloc_hook)(void *ptr, size_t size, const void *caller); void *(*__memalign_hook)(size_t alignment, size_t size, const void *caller); void (*__free_hook)(void *ptr, const void *caller); void (*__malloc_initialize_hook)(void); void (*__after_morecore_hook)(void); mallopt, malloc_trim, malloc_usable_size, malloc_stats, mal‐ loc_get_state, malloc_set_state, mallinfo - dynamic allocation tuning #include int mallopt (int param, int value); int malloc_trim (size_t pad); size_t malloc_usable_size (void *ptr); void malloc_stats (void); void *malloc_get_state (void); int malloc_set_state (void *ptr); struct mallinfo mallinfo (void); matherr - SVID math library exception handling #define _SVID_SOURCE /* See feature_test_macros(7) */ #include int matherr(struct exception *exc); extern _LIB_VERSION_TYPE _LIB_VERSION; Link with -lm. MB_CUR_MAX - maximum length of a multibyte character in the current locale #include mblen - determine number of bytes in next multibyte character #include int mblen(const char *s, size_t n); MB_LEN_MAX - maximum multibyte length of a character across all locales #include mbrlen - determine number of bytes in next multibyte character #include size_t mbrlen(const char *s, size_t n, mbstate_t *ps); mbrtowc - convert a multibyte sequence to a wide character #include size_t mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps); mbsinit - test for initial shift state #include int mbsinit(const mbstate_t *ps); mbsnrtowcs - convert a multibyte string to a wide-character string #include size_t mbsnrtowcs(wchar_t *dest, const char **src, size_t nms, size_t len, mbstate_t *ps); mbsrtowcs - convert a multibyte string to a wide-character string #include size_t mbsrtowcs(wchar_t *dest, const char **src, size_t len, mbstate_t *ps); mbstowcs - convert a multibyte string to a wide-character string #include size_t mbstowcs(wchar_t *dest, const char *src, size_t n); mbtowc - convert a multibyte sequence to a wide character #include int mbtowc(wchar_t *pwc, const char *s, size_t n); memccpy - copy memory area #include void *memccpy(void *dest, const void *src, int c, size_t n); memchr, memrchr, rawmemchr - scan memory for a character #include void *memchr(const void *s, int c, size_t n); void *memrchr(const void *s, int c, size_t n); void *rawmemchr(const void *s, int c); memcmp - compare memory areas #include int memcmp(const void *s1, const void *s2, size_t n); memcpy - copy memory area #include void *memcpy(void *dest, const void *src, size_t n); memfrob - frobnicate (encrypt) a memory area #define _GNU_SOURCE /* See feature_test_macros(7) */ #include void *memfrob(void *s, size_t n); memmem - locate a substring #define _GNU_SOURCE #include void *memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen); memmove - copy memory area #include void *memmove(void *dest, const void *src, size_t n); mempcpy, wmempcpy - copy memory area #define _GNU_SOURCE #include void *mempcpy(void *dest, const void *src, size_t n); #define _GNU_SOURCE #include wchar_t *wmempcpy(wchar_t *dest, const wchar_t *src, size_t n); memset - fill memory with a constant byte #include void *memset(void *s, int c, size_t n); mkdtemp - create a unique temporary directory #include char *mkdtemp(char *template); mkfifo - make a FIFO special file (a named pipe) #include #include int mkfifo(const char *pathname, mode_t mode); mkfifoat - make a FIFO (named pipe) relative to a directory file descriptor #include /* Definition of AT_* constants */ #include int mkfifoat(int dirfd, const char *pathname, mode_t mode); mkstemp, mkostemp - create a unique temporary file #include int mkstemp(char *template); int mkostemp (char *template, int flags); int mkstemps(char *template, int suffixlen); int mkostemps(char *template, int suffixlen, int flags); mktemp - make a unique temporary filename #include char *mktemp(char *template); modf, modff, modfl - extract signed integral and fractional values from floating-point number #include double modf(double x, double *iptr); float modff(float x, float *iptr); long double modfl(long double x, long double *iptr); Link with -lm. mpool - shared memory buffer pool #include #include MPOOL *mpool_open(DBT *key, int fd, pgno_t pagesize, pgno_t maxcache); void mpool_filter(MPOOL *mp, void (*pgin)(void *, pgno_t, void *), void (*pgout)(void *, pgno_t, void *), void *pgcookie); void *mpool_new(MPOOL *mp, pgno_t *pgnoaddr); void *mpool_get(MPOOL *mp, pgno_t pgno, unsigned int flags); int mpool_put(MPOOL *mp, void *pgaddr, unsigned int flags); int mpool_sync(MPOOL *mp); int mpool_close(MPOOL *mp); mq_close - close a message queue descriptor #include int mq_close(mqd_t mqdes); Link with -lrt. mq_getattr, mq_setattr - get/set message queue attributes #include int mq_getattr(mqd_t mqdes, struct mq_attr *attr); int mq_setattr(mqd_t mqdes, struct mq_attr *newattr, struct mq_attr *oldattr); Link with -lrt. mq_notify - register for notification when a message is available #include int mq_notify(mqd_t mqdes, const struct sigevent *notification); Link with -lrt. mq_open - open a message queue #include /* For O_* constants */ #include /* For mode constants */ #include mqd_t mq_open(const char *name, int oflag); mqd_t mq_open(const char *name, int oflag, mode_t mode, struct mq_attr *attr); Link with -lrt. mq_receive, mq_timedreceive - receive a message from a message queue #include ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio); #include #include ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); Link with -lrt. mq_send, mq_timedsend - send a message to a message queue #include int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio); #include #include int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio, const struct timespec *abs_timeout); Link with -lrt. mq_unlink - remove a message queue #include int mq_unlink(const char *name); Link with -lrt. mtrace, muntrace - malloc debugging #include void mtrace(void); void muntrace(void); nan, nanf, nanl - return 'Not a Number' #include double nan(const char *tagp); float nanf(const char *tagp); long double nanl(const char *tagp); Link with -lm. netlink - Netlink macros #include #include int NLMSG_ALIGN(size_t len); int NLMSG_LENGTH(size_t len); int NLMSG_SPACE(size_t len); void *NLMSG_DATA(struct nlmsghdr *nlh); struct nlmsghdr *NLMSG_NEXT(struct nlmsghdr *nlh, int len); int NLMSG_OK(struct nlmsghdr *nlh, int len); int NLMSG_PAYLOAD(struct nlmsghdr *nlh, int len); nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, nexttowardl - floating-point number manipulation #include double nextafter(double x, double y); float nextafterf(float x, float y); long double nextafterl(long double x, long double y); double nexttoward(double x, long double y); float nexttowardf(float x, long double y); long double nexttowardl(long double x, long double y); Link with -lm. nl_langinfo - query language and locale information #include char *nl_langinfo(nl_item item); offsetof - offset of a structure member #include size_t offsetof(type, member); on_exit - register a function to be called at normal process termina‐ tion #include int on_exit(void (*function)(int , void *), void *arg); opendir, fdopendir - open a directory #include #include DIR *opendir(const char *name); DIR *fdopendir(int fd); openpty, login_tty, forkpty - tty utility functions #include int openpty(int *amaster, int *aslave, char *name, const struct termios *termp, const struct winsize *winp); pid_t forkpty(int *amaster, char *name, const struct termios *termp, const struct winsize *winp); #include int login_tty(int fd); Link with -lutil. perror - print a system error message #include void perror(const char *s); #include const char *sys_errlist[]; int sys_nerr; int errno; popen, pclose - pipe stream to or from a process #include FILE *popen(const char *command, const char *type); int pclose(FILE *stream); posix_fallocate - allocate file space #include int posix_fallocate(int fd, off_t offset, off_t len); posix_memalign, memalign, valloc - Allocate aligned memory #include int posix_memalign(void **memptr, size_t alignment, size_t size); #include void *valloc(size_t size); void *memalign(size_t boundary, size_t size); posix_openpt - open a pseudo-terminal device #include #include int posix_openpt(int flags); pow10, pow10f, pow10l - base-10 power functions #define _GNU_SOURCE #include double pow10(double x); float pow10f(float x); long double pow10l(long double x); Link with -lm. pow, powf, powl - power functions #include double pow(double x, double y); float powf(float x, float y); long double powl(long double x, long double y); Link with -lm. printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - formatted output conversion #include int printf(const char *format, ...); int fprintf(FILE *stream, const char *format, ...); int sprintf(char *str, const char *format, ...); int snprintf(char *str, size_t size, const char *format, ...); #include int vprintf(const char *format, va_list ap); int vfprintf(FILE *stream, const char *format, va_list ap); int vsprintf(char *str, const char *format, va_list ap); int vsnprintf(char *str, size_t size, const char *format, va_list ap); profil - execution time profile #include int profil(unsigned short *buf, size_t bufsiz, size_t offset, unsigned int scale); program_invocation_name, program_invocation_short_name - obtain name used to invoke calling program #define _GNU_SOURCE #include extern char *program_invocation_name; extern char *program_invocation_short_name; psignal - print signal message #include void psignal(int sig, const char *s); extern const char *const sys_siglist[]; pthread_attr_init, pthread_attr_destroy - initialize and destroy thread attributes object #include int pthread_attr_init(pthread_attr_t *attr); int pthread_attr_destroy(pthread_attr_t *attr); Compile and link with -pthread. pthread_attr_setaffinity_np, pthread_attr_getaffinity_np - set/get CPU affinity attribute in thread attributes object #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int pthread_attr_setaffinity_np(pthread_attr_t *attr, size_t cpusetsize, const cpu_set_t *cpuset); int pthread_attr_getaffinity_np(pthread_attr_t *attr, size_t cpusetsize, cpu_set_t *cpuset); Compile and link with -pthread. pthread_attr_setdetachstate, pthread_attr_getdetachstate - set/get detach state attribute in thread attributes object #include int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate); int pthread_attr_getdetachstate(pthread_attr_t *attr, int *detachstate); Compile and link with -pthread. pthread_attr_setguardsize, pthread_attr_getguardsize - set/get guard size attribute in thread attributes object #include int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize); int pthread_attr_getguardsize(pthread_attr_t *attr, size_t *guardsize); Compile and link with -pthread. pthread_attr_setinheritsched, pthread_attr_getinheritsched - set/get inherit scheduler attribute in thread attributes object #include int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched); int pthread_attr_getinheritsched(pthread_attr_t *attr, int *inheritsched); Compile and link with -pthread. pthread_attr_setschedparam, pthread_attr_getschedparam - set/get sched‐ uling parameter attributes in thread attributes object #include int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param); int pthread_attr_getschedparam(pthread_attr_t *attr, struct sched_param *param); Compile and link with -pthread. pthread_attr_setschedpolicy, pthread_attr_getschedpolicy - set/get scheduling policy attribute in thread attributes object #include int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy); int pthread_attr_getschedpolicy(pthread_attr_t *attr, int *policy); Compile and link with -pthread. pthread_attr_setscope, pthread_attr_getscope - set/get contention scope attribute in thread attributes object #include int pthread_attr_setscope(pthread_attr_t *attr, int scope); int pthread_attr_getscope(pthread_attr_t *attr, int *scope); Compile and link with -pthread. pthread_attr_setstack, pthread_attr_getstack - set/get stack attributes in thread attributes object #include int pthread_attr_setstack(pthread_attr_t *attr, void *stackaddr, size_t stacksize); int pthread_attr_getstack(pthread_attr_t *attr, void **stackaddr, size_t *stacksize); Compile and link with -pthread. pthread_attr_setstackaddr, pthread_attr_getstackaddr - set/get stack address attribute in thread attributes object #include int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr); int pthread_attr_getstackaddr(pthread_attr_t *attr, void **stackaddr); Compile and link with -pthread. pthread_attr_setstacksize, pthread_attr_getstacksize - set/get stack size attribute in thread attributes object #include int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize); int pthread_attr_getstacksize(pthread_attr_t *attr, size_t *stacksize); Compile and link with -pthread. pthread_cancel - send a cancellation request to a thread #include int pthread_cancel(pthread_t thread); Compile and link with -pthread. pthread_cleanup_push, pthread_cleanup_pop - push and pop thread cancel‐ lation clean-up handlers #include void pthread_cleanup_push(void (*routine)(void *), void *arg); void pthread_cleanup_pop(int execute); Compile and link with -pthread. pthread_cleanup_push_defer_np, pthread_cleanup_pop_restore_np - push and pop thread cancellation clean-up handlers while saving cancelabil‐ ity type #include void pthread_cleanup_push_defer_np(void (*routine)(void *), void *arg); void pthread_cleanup_pop_restore_np(int execute); Compile and link with -pthread. pthread_create - create a new thread #include int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg); Compile and link with -pthread. pthread_detach - detach a thread #include int pthread_detach(pthread_t thread); Compile and link with -pthread. pthread_equal - compare thread IDs #include int pthread_equal(pthread_t t1, pthread_t t2); Compile and link with -pthread. pthread_exit - terminate calling thread #include void pthread_exit(void *retval); Compile and link with -pthread. pthread_getattr_np - get attributes of created thread #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int pthread_getattr_np(pthread_t thread, pthread_attr_t *attr); Compile and link with -pthread. pthread_getcpuclockid - retrieve ID of a thread's CPU time clock #include #include int pthread_getcpuclockid(pthread_t thread, clockid_t *clock_id); Compile and link with -pthread. pthread_join - join with a terminated thread #include int pthread_join(pthread_t thread, void **retval); Compile and link with -pthread. pthread_kill - send a signal to a thread #include int pthread_kill(pthread_t thread, int sig); Compile and link with -pthread. pthread_kill_other_threads_np - terminate all other threads in process #include void pthread_kill_other_threads_np(void); pthread_self - obtain ID of the calling thread #include pthread_t pthread_self(void); Compile and link with -pthread. pthread_setaffinity_np, pthread_getaffinity_np - set/get CPU affinity of a thread #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize, const cpu_set_t *cpuset); int pthread_getaffinity_np(pthread_t thread, size_t cpusetsize, cpu_set_t *cpuset); Compile and link with -pthread. pthread_setcancelstate, pthread_setcanceltype - set cancelability state and type #include int pthread_setcancelstate(int state, int *oldstate); int pthread_setcanceltype(int type, int *oldtype); Compile and link with -pthread. pthread_setconcurrency, pthread_getconcurrency - set/get the concur‐ rency level #include int pthread_setconcurrency(int new_level); int pthread_getconcurrency(void); Compile and link with -pthread. pthread_setschedparam, pthread_getschedparam - set/get scheduling pol‐ icy and parameters of a thread #include pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param); pthread_getschedparam(pthread_t thread, int *policy, struct sched_param *param); Compile and link with -pthread. pthread_setschedprio - set scheduling priority of a thread #include pthread_setschedprio(pthread_t thread, int prio); Compile and link with -pthread. pthread_sigmask - examine and change mask of blocked signals #include int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset); Compile and link with -pthread. pthread_testcancel - request delivery of any pending cancellation request #include void pthread_testcancel(void); Compile and link with -pthread. pthread_tryjoin_np, pthread_timedjoin_np - try to join with a termi‐ nated thread #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int pthread_tryjoin_np(pthread_t thread, void **retval); int pthread_timedjoin_np(pthread_t thread, void **retval, const struct timespec *abstime); Compile and link with -pthread. pthread_yield - yield the processor #include int pthread_yield(void); Compile and link with -pthread. ptsname, ptsname_r - get the name of the slave pseudo-terminal #define _XOPEN_SOURCE #include char *ptsname(int fd); #define _GNU_SOURCE #include int ptsname_r(int fd, char *buf, size_t buflen); putenv - change or add an environment variable #include int putenv(char *string); putgrent - write a group database entry to a file #define _GNU_SOURCE #include int putgrent(const struct group *grp, FILE *fp); putpwent - write a password file entry #include #include #include int putpwent(const struct passwd *p, FILE *stream); fputc, fputs, putc, putchar, puts - output of characters and strings #include int fputc(int c, FILE *stream); int fputs(const char *s, FILE *stream); int putc(int c, FILE *stream); int putchar(int c); int puts(const char *s); putwchar - write a wide character to standard output #include wint_t putwchar(wchar_t wc); qecvt, qfcvt, qgcvt - convert a floating-point number to a string #include char *qecvt(long double number, int ndigits, int *decpt, int *sign); char *qfcvt(long double number, int ndigits, int *decpt, int *sign); char *qgcvt(long double number, int ndigit, char *buf); qsort - sorts an array #include void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); LIST_ENTRY, LIST_HEAD, LIST_INIT, LIST_INSERT_AFTER, LIST_INSERT_HEAD, LIST_REMOVE, TAILQ_ENTRY, TAILQ_HEAD, TAILQ_INIT, TAILQ_INSERT_AFTER, TAILQ_INSERT_HEAD, TAILQ_INSERT_TAIL, TAILQ_REMOVE, CIRCLEQ_ENTRY, CIR‐ CLEQ_HEAD, CIRCLEQ_INIT, CIRCLEQ_INSERT_AFTER, CIRCLEQ_INSERT_BEFORE, CIRCLEQ_INSERT_HEAD, CIRCLEQ_INSERT_TAIL, CIRCLEQ_REMOVE - implementa‐ tions of lists, tail queues, and circular queues #include LIST_ENTRY(TYPE); LIST_HEAD(HEADNAME, TYPE); LIST_INIT(LIST_HEAD *head); LIST_INSERT_AFTER(LIST_ENTRY *listelm, TYPE *elm, LIST_ENTRY NAME); LIST_INSERT_HEAD(LIST_HEAD *head, TYPE *elm, LIST_ENTRY NAME); LIST_REMOVE(TYPE *elm, LIST_ENTRY NAME); TAILQ_ENTRY(TYPE); TAILQ_HEAD(HEADNAME, TYPE); TAILQ_INIT(TAILQ_HEAD *head); TAILQ_INSERT_AFTER(TAILQ_HEAD *head, TYPE *listelm, TYPE *elm, TAILQ_ENTRY NAME); TAILQ_INSERT_HEAD(TAILQ_HEAD *head, TYPE *elm, TAILQ_ENTRY NAME); TAILQ_INSERT_TAIL(TAILQ_HEAD *head, TYPE *elm, TAILQ_ENTRY NAME); TAILQ_REMOVE(TAILQ_HEAD *head, TYPE *elm, TAILQ_ENTRY NAME); CIRCLEQ_ENTRY(TYPE); CIRCLEQ_HEAD(HEADNAME, TYPE); CIRCLEQ_INIT(CIRCLEQ_HEAD *head); CIRCLEQ_INSERT_AFTER(CIRCLEQ_HEAD *head, TYPE *listelm, TYPE *elm, CIRCLEQ_ENTRY NAME); CIRCLEQ_INSERT_BEFORE(CIRCLEQ_HEAD *head, TYPE *listelm, TYPE *elm, CIRCLEQ_ENTRY NAME); CIRCLEQ_INSERT_HEAD(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME); CIRCLEQ_INSERT_TAIL(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME); CIRCLEQ_REMOVE(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME); raise - send a signal to the caller #include int raise(int sig); rand, rand_r, srand - pseudo-random number generator #include int rand(void); int rand_r(unsigned int *seedp); void srand(unsigned int seed); random, srandom, initstate, setstate - random number generator #include long int random(void); void srandom(unsigned int seed); char *initstate(unsigned int seed, char *state, size_t n); char *setstate(char *state); random_r, srandom_r, initstate_r, setstate_r - reentrant random number generator #include int random_r(struct random_data *buf, int32_t *result); int srandom_r(unsigned int seed, struct random_data *buf); int initstate_r(unsigned int seed, char *statebuf, size_t statelen, struct random_data *buf); int setstate_r(char *statebuf, struct random_data *buf); rcmd, rresvport, iruserok, ruserok - routines for returning a stream to a remote command #include /* Or on some systems */ int rcmd(char **ahost, int inport, const char *locuser, const char *remuser, const char *cmd, int *fd2p); int rresvport(int *port); int iruserok(uint32_t raddr, int superuser, const char *ruser, const char *luser); int ruserok(const char *rhost, int superuser, const char *ruser, const char *luser); readdir, readdir_r - read a directory #include struct dirent *readdir(DIR *dirp); int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); realpath - return the canonicalized absolute pathname #include #include char *realpath(const char *path, char *resolved_path); recno - record number database access method #include #include re_comp, re_exec - BSD regex functions #define _REGEX_RE_COMP #include #include char *re_comp(char *regex); int re_exec(char *string); regcomp, regexec, regerror, regfree - POSIX regex functions #include #include int regcomp(regex_t *preg, const char *regex, int cflags); int regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags); size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size); void regfree(regex_t *preg); drem, dremf, dreml, remainder, remainderf, remainderl - floating-point remainder function #include /* The C99 versions */ double remainder(double x, double y); float remainderf(float x, float y); long double remainderl(long double x, long double y); /* Obsolete synonyms */ double drem(double x, double y); float dremf(float x, float y); long double dreml(long double x, long double y); Link with -lm. remove - remove a file or directory #include int remove(const char *pathname); remquo, remquof, remquol - remainder and part of quotient #include double remquo(double x, double y, int *quo); float remquof(float x, float y, int *quo); long double remquol(long double x, long double y, int *quo); Link with -lm. res_init, res_query, res_search, res_querydomain, res_mkquery, res_send, dn_comp, dn_expand - resolver routines #include #include #include extern struct state _res; int res_init(void); int res_query(const char *dname, int class, int type, unsigned char *answer, int anslen); int res_search(const char *dname, int class, int type, unsigned char *answer, int anslen); int res_querydomain(const char *name, const char *domain, int class, int type, unsigned char *answer, int anslen); int res_mkquery(int op, const char *dname, int class, int type, char *data, int datalen, struct rrec *newrr, char *buf, int buflen); int res_send(const char *msg, int msglen, char *answer, int anslen); int dn_comp(unsigned char *exp_dn, unsigned char *comp_dn, int length, unsigned char **dnptrs, unsigned char **lastdnptr); int dn_expand(unsigned char *msg, unsigned char *eomorig, unsigned char *comp_dn, char *exp_dn, int length); Link with -lresolv. rewinddir - reset directory stream #include #include void rewinddir(DIR *dirp); rexec - return stream to a remote command #define _BSD_SOURCE /* See feature_test_macros(7) */ #include int rexec(char **ahost, int inport, char *user, char *passwd, char *cmd, int *fd2p); nearbyint, nearbyintf, nearbyintl, rint, rintf, rintl - round to near‐ est integer #include double nearbyint(double x); float nearbyintf(float x); long double nearbyintl(long double x); double rint(double x); float rintf(float x); long double rintl(long double x); Link with -lm. round, roundf, roundl - round to nearest integer, away from zero #include double round(double x); float roundf(float x); long double roundl(long double x); Link with -lm. rpc - library routines for remote procedure calls rpmatch - determine if the answer to a question is affirmative or nega‐ tive #include int rpmatch(const char *response); rtime - get time from a remote machine #include int rtime(struct sockaddr_in *addrp, struct rpc_timeval *timep, struct rpc_timeval *timeout); rtnetlink - macros to manipulate rtnetlink messages #include #include #include #include rtnetlink_socket = socket(AF_NETLINK, int socket_type, NETLINK_ROUTE); int RTA_OK(struct rtattr *rta, int rtabuflen); void *RTA_DATA(struct rtattr *rta); unsigned int RTA_PAYLOAD(struct rtattr *rta); struct rtattr *RTA_NEXT(struct rtattr *rta, unsigned int rtabuflen); unsigned int RTA_LENGTH(unsigned int length); unsigned int RTA_SPACE(unsigned int length); scalb, scalbf, scalbl - multiply floating-point number by integral power of radix (OBSOLETE) #include double scalb(double x, double exp); float scalbf(float x, double exp); long double scalbl(long double x, double exp); Link with -lm. scalbn, scalbnf, scalbnl, scalbln, scalblnf, scalblnl - multiply float‐ ing-point number by integral power of radix #include double scalbln(double x, long int exp); float scalblnf(float x, long int exp); long double scalblnl(long double x, long int exp); double scalbn(double x, int exp); float scalbnf(float x, int exp); long double scalbnl(long double x, int exp); Link with -lm. scandir, alphasort, versionsort - scan a directory for matching entries #include int scandir(const char *dirp, struct dirent ***namelist, int (*filter)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)); int alphasort(const void *a, const void *b); int versionsort(const void *a, const void *b); scanf, fscanf, sscanf, vscanf, vsscanf, vfscanf - input format conver‐ sion #include int scanf(const char *format, ...); int fscanf(FILE *stream, const char *format, ...); int sscanf(const char *str, const char *format, ...); #include int vscanf(const char *format, va_list ap); int vsscanf(const char *str, const char *format, va_list ap); int vfscanf(FILE *stream, const char *format, va_list ap); sched_getcpu - determine CPU on which the calling thread is running #define _GNU_SOURCE #include int sched_getcpu(void); seekdir - set the position of the next readdir() call in the directory stream. #include void seekdir(DIR *dirp, long offset); sem_close - close a named semaphore #include int sem_close(sem_t *sem); Link with -lrt or -pthread. sem_destroy - destroy an unnamed semaphore #include int sem_destroy(sem_t *sem); Link with -lrt or -pthread. sem_getvalue - get the value of a semaphore #include int sem_getvalue(sem_t *sem, int *sval); Link with -lrt or -pthread. sem_init - initialize an unnamed semaphore #include int sem_init(sem_t *sem, int pshared, unsigned int value); Link with -lrt or -pthread. sem_open - initialize and open a named semaphore #include /* For O_* constants */ #include /* For mode constants */ #include sem_t *sem_open(const char *name, int oflag); sem_t *sem_open(const char *name, int oflag, mode_t mode, unsigned int value); Link with -lrt or -pthread. sem_post - unlock a semaphore #include int sem_post(sem_t *sem); Link with -lrt or -pthread. sem_unlink - remove a named semaphore #include int sem_unlink(const char *name); Link with -lrt or -pthread. sem_wait, sem_timedwait, sem_trywait - lock a semaphore #include int sem_wait(sem_t *sem); int sem_trywait(sem_t *sem); int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout); Link with -lrt or -pthread. setaliasent, endaliasent, getaliasent, getaliasent_r, getaliasbyname, getaliasbyname_r - read an alias entry #include void setaliasent(void); void endaliasent(void); struct aliasent *getaliasent(void); int getaliasent_r(struct aliasent *result, char *buffer, size_t buflen, struct aliasent **res); struct aliasent *getaliasbyname(const char *name); int getaliasbyname_r(const char *name, struct aliasent *result, char *buffer, size_t buflen, struct aliasent **res); setbuf, setbuffer, setlinebuf, setvbuf - stream buffering operations #include void setbuf(FILE *stream, char *buf); void setbuffer(FILE *stream, char *buf, size_t size); void setlinebuf(FILE *stream); int setvbuf(FILE *stream, char *buf, int mode, size_t size); setenv - change or add an environment variable #include int setenv(const char *name, const char *value, int overwrite); int unsetenv(const char *name); __setfpucw - set FPU control word on i386 architecture (obsolete) #include void __setfpucw(unsigned short control_word); setjmp, sigsetjmp - save stack context for nonlocal goto #include int setjmp(jmp_buf env); int sigsetjmp(sigjmp_buf env, int savesigs); setlocale - set the current locale #include char *setlocale(int category, const char *locale); setlogmask - set log priority mask #include int setlogmask(int mask); setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr - handle network group entries #include int setnetgrent(const char *netgroup); void endnetgrent(void); int getnetgrent(char **host, char **user, char **domain); int getnetgrent_r(char **host, char **user, char **domain, char *buf, int buflen); int innetgr(const char *netgroup, const char *host, const char *user, const char *domain); shm_open, shm_unlink - Create/open or unlink POSIX shared memory objects #include #include /* For mode constants */ #include /* For O_* constants */ int shm_open(const char *name, int oflag, mode_t mode); int shm_unlink(const char *name); Link with -lrt. siginterrupt - allow signals to interrupt system calls #include int siginterrupt(int sig, int flag); signbit - test sign of a real floating-point number #include int signbit(x); Link with -lm. significand, significandf, significandl - get mantissa of floating- point number #include double significand(double x); float significandf(float x); long double significandl(long double x); Link with -lm. sigpause - atomically release blocked signals and wait for interrupt #include int sigpause(int sigmask); /* BSD */ int sigpause(int sig); /* System V / Unix95 */ sigset, sighold, sigrelse, sigignore - System V signal API #include typedef void (*sighandler_t)(int); sighandler_t sigset(int sig, sighandler_t disp); int sighold(int sig); int sigrelse(int sig); int sigignore(int sig); sigemptyset, sigfillset, sigaddset, sigdelset, sigismember - POSIX sig‐ nal set operations. #include int sigemptyset(sigset_t *set); int sigfillset(sigset_t *set); int sigaddset(sigset_t *set, int signum); int sigdelset(sigset_t *set, int signum); int sigismember(const sigset_t *set, int signum); sigvec, sigblock, sigsetmask, siggetmask, sigmask - BSD signal API #include int sigvec(int sig, struct sigvec *vec, struct sigvec *ovec); int sigmask(int signum); int sigblock(int mask); int sigsetmask(int mask); int siggetmask(void); sin, sinf, sinl - sine function #include double sin(double x); float sinf(float x); long double sinl(long double x); Link with -lm. sincos, sincosf, sincosl - calculate sin and cos simultaneously #define _GNU_SOURCE #include void sincos(double x, double *sin, double *cos); void sincosf(float x, float *sin, float *cos); void sincosl(long double x, long double *sin, long double *cos); Link with -lm. sinh, sinhf, sinhl - hyperbolic sine function #include double sinh(double x); float sinhf(float x); long double sinhl(long double x); Link with -lm. sleep - Sleep for the specified number of seconds #include unsigned int sleep(unsigned int seconds); sockatmark - determine whether socket is at out-of-band mark #include int sockatmark(int sockfd); sqrt, sqrtf, sqrtl - square root function #include double sqrt(double x); float sqrtf(float x); long double sqrtl(long double x); Link with -lm. statvfs, fstatvfs - get file system statistics #include int statvfs(const char *path, struct statvfs *buf); int fstatvfs(int fd, struct statvfs *buf); stdarg, va_start, va_arg, va_end, va_copy - variable argument lists #include void va_start(va_list ap, last); type va_arg(va_list ap, type); void va_end(va_list ap); void va_copy(va_list dest, va_list src); stdin, stdout, stderr - standard I/O streams #include extern FILE *stdin; extern FILE *stdout; extern FILE *stderr; stdio - standard input/output library functions #include FILE *stdin; FILE *stdout; FILE *stderr; __fbufsize, __flbf, __fpending, __fpurge, __freadable, __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf - interfaces to stdio FILE structure #include #include size_t __fbufsize(FILE *stream); size_t __fpending(FILE *stream); int __flbf(FILE *stream); int __freadable(FILE *stream); int __fwritable(FILE *stream); int __freading(FILE *stream); int __fwriting(FILE *stream); int __fsetlocking(FILE *stream, int type); void _flushlbf(void); void __fpurge(FILE *stream); stpcpy - copy a string returning a pointer to its end #include char *stpcpy(char *dest, const char *src); stpncpy - copy a fixed-size string, returning a pointer to its end #include char *stpncpy(char *dest, const char *src, size_t n); strcasecmp, strncasecmp - compare two strings ignoring case #include int strcasecmp(const char *s1, const char *s2); int strncasecmp(const char *s1, const char *s2, size_t n); strcat, strncat - concatenate two strings #include char *strcat(char *dest, const char *src); char *strncat(char *dest, const char *src, size_t n); strchr, strrchr, strchrnul - locate character in string #include char *strchr(const char *s, int c); char *strrchr(const char *s, int c); #define _GNU_SOURCE #include char *strchrnul(const char *s, int c); strcmp, strncmp - compare two strings #include int strcmp(const char *s1, const char *s2); int strncmp(const char *s1, const char *s2, size_t n); strcoll - compare two strings using the current locale #include int strcoll(const char *s1, const char *s2); strcpy, strncpy - copy a string #include char *strcpy(char *dest, const char *src); char *strncpy(char *dest, const char *src, size_t n); strdup, strndup, strdupa, strndupa - duplicate a string #include char *strdup(const char *s); char *strndup(const char *s, size_t n); char *strdupa(const char *s); char *strndupa(const char *s, size_t n); strerror, strerror_r - return string describing error number #include char *strerror(int errnum); int strerror_r(int errnum, char *buf, size_t buflen); /* XSI-compliant */ char *strerror_r(int errnum, char *buf, size_t buflen); /* GNU-specific */ strfmon - convert monetary value to a string #include ssize_t strfmon(char *s, size_t max, const char *format, ...); strfry - randomize a string #define _GNU_SOURCE #include char *strfry(char *string); strftime - format date and time #include size_t strftime(char *s, size_t max, const char *format, const struct tm *tm); stpcpy, strcasecmp, strcat, strchr, strcmp, strcoll, strcpy, strcspn, strdup, strfry, strlen, strncat, strncmp, strncpy, strncasecmp, strp‐ brk, strrchr, strsep, strspn, strstr, strtok, strxfrm, index, rindex - string operations #include int strcasecmp(const char *s1, const char *s2); int strncasecmp(const char *s1, const char *s2, size_t n); char *index(const char *s, int c); char *rindex(const char *s, int c); #include char *stpcpy(char *dest, const char *src); char *strcat(char *dest, const char *src); char *strchr(const char *s, int c); int strcmp(const char *s1, const char *s2); int strcoll(const char *s1, const char *s2); char *strcpy(char *dest, const char *src); size_t strcspn(const char *s, const char *reject); char *strdup(const char *s); char *strfry(char *string); size_t strlen(const char *s); char *strncat(char *dest, const char *src, size_t n); int strncmp(const char *s1, const char *s2, size_t n); char *strncpy(char *dest, const char *src, size_t n); char *strpbrk(const char *s, const char *accept); char *strrchr(const char *s, int c); char *strsep(char **stringp, const char *delim); size_t strspn(const char *s, const char *accept); char *strstr(const char *haystack, const char *needle); char *strtok(char *s, const char *delim); size_t strxfrm(char *dest, const char *src, size_t n); strlen - calculate the length of a string #include size_t strlen(const char *s); strnlen - determine the length of a fixed-size string #define _GNU_SOURCE #include size_t strnlen(const char *s, size_t maxlen); strpbrk - search a string for any of a set of characters #include char *strpbrk(const char *s, const char *accept); strptime - convert a string representation of time to a time tm struc‐ ture #define _XOPEN_SOURCE /* glibc2 needs this */ #include char *strptime(const char *s, const char *format, struct tm *tm); strsep - extract token from string #include char *strsep(char **stringp, const char *delim); strsignal - return string describing signal #include char *strsignal(int sig); extern const char * const sys_siglist[]; strspn, strcspn - search a string for a set of characters #include size_t strspn(const char *s, const char *accept); size_t strcspn(const char *s, const char *reject); strstr, strcasestr - locate a substring #include char *strstr(const char *haystack, const char *needle); #define _GNU_SOURCE #include char *strcasestr(const char *haystack, const char *needle); strtod, strtof, strtold - convert ASCII string to floating-point number #include double strtod(const char *nptr, char **endptr); float strtof(const char *nptr, char **endptr); long double strtold(const char *nptr, char **endptr); strtoimax, strtoumax - convert string to integer #include intmax_t strtoimax(const char *nptr, char **endptr, int base); uintmax_t strtoumax(const char *nptr, char **endptr, int base); strtok, strtok_r - extract tokens from strings #include char *strtok(char *str, const char *delim); char *strtok_r(char *str, const char *delim, char **saveptr); strtol, strtoll, strtoq - convert a string to a long integer #include long int strtol(const char *nptr, char **endptr, int base); long long int strtoll(const char *nptr, char **endptr, int base); strtoul, strtoull, strtouq - convert a string to an unsigned long inte‐ ger #include unsigned long int strtoul(const char *nptr, char **endptr, int base); unsigned long long int strtoull(const char *nptr, char **endptr, int base); strverscmp - compare two version strings #define _GNU_SOURCE #include int strverscmp(const char *s1, const char *s2); strxfrm - string transformation #include size_t strxfrm(char *dest, const char *src, size_t n); swab - swap adjacent bytes #define _XOPEN_SOURCE #include void swab(const void *from, void *to, ssize_t n); sysconf - Get configuration information at runtime #include long sysconf(int name); closelog, openlog, syslog, vsyslog - send messages to the system logger #include void openlog(const char *ident, int option, int facility); void syslog(int priority, const char *format, ...); void closelog(void); #include void vsyslog(int priority, const char *format, va_list ap); system - execute a shell command #include int system(const char *command); sysv_signal - signal handling with System V semantics #define _GNU_SOURCE #include typedef void (*sighandler_t)(int); sighandler_t sysv_signal(int signum, sighandler_t handler); tan, tanf, tanl - tangent function #include double tan(double x); float tanf(float x); long double tanl(long double x); Link with -lm. tanh, tanhf, tanhl - hyperbolic tangent function #include double tanh(double x); float tanhf(float x); long double tanhl(long double x); Link with -lm. tcgetpgrp, tcsetpgrp - get and set terminal foreground process group #include pid_t tcgetpgrp(int fd); int tcsetpgrp(int fd, pid_t pgrp); tcgetsid - get session ID #define _XOPEN_SOURCE 500 /* See feature_test_macros(7) */ #include pid_t tcgetsid(int fd); telldir - return current location in directory stream #include long telldir(DIR *dirp); tempnam - create a name for a temporary file #include char *tempnam(const char *dir, const char *pfx); termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow, cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, cfset‐ speed - get and set terminal attributes, line control, get and set baud rate #include #include int tcgetattr(int fd, struct termios *termios_p); int tcsetattr(int fd, int optional_actions, const struct termios *termios_p); int tcsendbreak(int fd, int duration); int tcdrain(int fd); int tcflush(int fd, int queue_selector); int tcflow(int fd, int action); void cfmakeraw(struct termios *termios_p); speed_t cfgetispeed(const struct termios *termios_p); speed_t cfgetospeed(const struct termios *termios_p); int cfsetispeed(struct termios *termios_p, speed_t speed); int cfsetospeed(struct termios *termios_p, speed_t speed); int cfsetspeed(struct termios *termios_p, speed_t speed); tgamma, tgammaf, tgammal - true gamma function #include double tgamma(double x); float tgammaf(float x); long double tgammal(long double x); Link with -lm. timegm, timelocal - inverses of gmtime and localtime #include time_t timelocal(struct tm *tm); time_t timegm(struct tm *tm); timeradd, timersub, timercmp, timerclear, timerisset - timeval opera‐ tions #include void timeradd(struct timeval *a, struct timeval *b, struct timeval *res); void timersub(struct timeval *a, struct timeval *b, struct timeval *res); void timerclear(struct timeval *tvp); int timerisset(struct timeval *tvp); int timercmp(struct timeval *a, struct timeval *b, CMP); tmpfile - create a temporary file #include FILE *tmpfile(void); tmpnam, tmpnam_r - create a name for a temporary file #include char *tmpnam(char *s); toascii - convert character to ASCII #include int toascii(int c); toupper, tolower - convert letter to upper or lower case #include int toupper(int c); int tolower(int c); towctrans - wide-character transliteration #include wint_t towctrans(wint_t wc, wctrans_t desc); towlower - convert a wide character to lowercase #include wint_t towlower(wint_t wc); towupper - convert a wide character to uppercase #include wint_t towupper(wint_t wc); trunc, truncf, truncl - round to integer, towards zero #include double trunc(double x); float truncf(float x); long double truncl(long double x); Link with -lm. tsearch, tfind, tdelete, twalk, tdestroy - manage a binary tree #include void *tsearch(const void *key, void **rootp, int (*compar)(const void *, const void *)); void *tfind(const void *key, const void **rootp, int (*compar)(const void *, const void *)); void *tdelete(const void *key, void **rootp, int (*compar)(const void *, const void *)); void twalk(const void *root, void (*action)(const void *nodep, const VISIT which, const int depth)); #define _GNU_SOURCE #include void tdestroy(void *root, void (*free_node)(void *nodep)); ttyname, ttyname_r - return name of a terminal #include char *ttyname(int fd); int ttyname_r(int fd, char *buf, size_t buflen); ttyslot - find the slot of the current user's terminal in some file #include /* on BSD-like systems, and Linux */ #include /* on System V-like systems */ int ttyslot(void); tzset, tzname, timezone, daylight - initialize time conversion informa‐ tion #include void tzset (void); extern char *tzname[2]; extern long timezone; extern int daylight; ualarm - schedule signal after given number of microseconds #include useconds_t ualarm(useconds_t usecs, useconds_t interval); ulimit - get and set user limits #include long ulimit(int cmd, long newlimit); none - undocumented library functions Undocumented library functions ungetwc - push back a wide character onto a FILE stream #include wint_t ungetwc(wint_t wc, FILE *stream); getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked - non‐ locking stdio functions #include int getc_unlocked(FILE *stream); int getchar_unlocked(void); int putc_unlocked(int c, FILE *stream); int putchar_unlocked(int c); void clearerr_unlocked(FILE *stream); int feof_unlocked(FILE *stream); int ferror_unlocked(FILE *stream); int fileno_unlocked(FILE *stream); int fflush_unlocked(FILE *stream); int fgetc_unlocked(FILE *stream); int fputc_unlocked(int c, FILE *stream); size_t fread_unlocked(void *ptr, size_t size, size_t n, FILE *stream); size_t fwrite_unlocked(const void *ptr, size_t size, size_t n, FILE *stream); char *fgets_unlocked(char *s, int n, FILE *stream); int fputs_unlocked(const char *s, FILE *stream); #include wint_t getwc_unlocked(FILE *stream); wint_t getwchar_unlocked(void); wint_t fgetwc_unlocked(FILE *stream); wint_t fputwc_unlocked(wchar_t wc, FILE *stream); wint_t putwc_unlocked(wchar_t wc, FILE *stream); wint_t putwchar_unlocked(wchar_t wc); wchar_t *fgetws_unlocked(wchar_t *ws, int n, FILE *stream); int fputws_unlocked(const wchar_t *ws, FILE *stream); unlockpt - unlock a pseudo-terminal master/slave pair #define _XOPEN_SOURCE #include int unlockpt(int fd); updwtmp, logwtmp - append an entry to the wtmp file #include void updwtmp(const char *wtmp_file, const struct utmp *ut); void logwtmp(const char *line, const char *name, const char *host); usleep - suspend execution for microsecond intervals #include int usleep(useconds_t usec); wcpcpy - copy a wide-character string, returning a pointer to its end #include wchar_t *wcpcpy(wchar_t *dest, const wchar_t *src); wcpncpy - copy a fixed-size string of wide characters, returning a pointer to its end #include wchar_t *wcpncpy(wchar_t *dest, const wchar_t *src, size_t n); wcrtomb - convert a wide character to a multibyte sequence #include size_t wcrtomb(char *s, wchar_t wc, mbstate_t *ps); wcscasecmp - compare two wide-character strings, ignoring case #include int wcscasecmp(const wchar_t *s1, const wchar_t *s2); wcscat - concatenate two wide-character strings #include wchar_t *wcscat(wchar_t *dest, const wchar_t *src); wcschr - search a wide character in a wide-character string #include wchar_t *wcschr(const wchar_t *wcs, wchar_t wc); wcscmp - compare two wide-character strings #include int wcscmp(const wchar_t *s1, const wchar_t *s2); wcscpy - copy a wide-character string #include wchar_t *wcscpy(wchar_t *dest, const wchar_t *src); wcscspn - search a wide-character string for any of a set of wide char‐ acters #include size_t wcscspn(const wchar_t *wcs, const wchar_t *reject); wcsdup - duplicate a wide-character string #include wchar_t *wcsdup(const wchar_t *s); wcslen - determine the length of a wide-character string #include size_t wcslen(const wchar_t *s); wcsncasecmp - compare two fixed-size wide-character strings, ignoring case #include int wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n); wcsncat - concatenate two wide-character strings #include wchar_t *wcsncat(wchar_t *dest, const wchar_t *src, size_t n); wcsncmp - compare two fixed-size wide-character strings #include int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n); wcsncpy - copy a fixed-size string of wide characters #include wchar_t *wcsncpy(wchar_t *dest, const wchar_t *src, size_t n); wcsnlen - determine the length of a fixed-size wide-character string #include size_t wcsnlen(const wchar_t *s, size_t maxlen); wcsnrtombs - convert a wide-character string to a multibyte string #include size_t wcsnrtombs(char *dest, const wchar_t **src, size_t nwc, size_t len, mbstate_t *ps); wcspbrk - search a wide-character string for any of a set of wide char‐ acters #include wchar_t *wcspbrk(const wchar_t *wcs, const wchar_t *accept); wcsrchr - search a wide character in a wide-character string #include wchar_t *wcsrchr(const wchar_t *wcs, wchar_t wc); wcsrtombs - convert a wide-character string to a multibyte string #include size_t wcsrtombs(char *dest, const wchar_t **src, size_t len, mbstate_t *ps); wcsspn - advance in a wide-character string, skipping any of a set of wide characters #include size_t wcsspn(const wchar_t *wcs, const wchar_t *accept); wcsstr - locate a substring in a wide-character string #include wchar_t *wcsstr(const wchar_t *haystack, const wchar_t *needle); wcstoimax, wcstoumax - convert wide-character string to integer #include #include intmax_t wcstoimax(const wchar_t *nptr, wchar_t **endptr, int base); uintmax_t wcstoumax(const wchar_t *nptr, wchar_t **endptr, int base); wcstok - split wide-character string into tokens #include wchar_t *wcstok(wchar_t *wcs, const wchar_t *delim, wchar_t **ptr); wcstombs - convert a wide-character string to a multibyte string #include size_t wcstombs(char *dest, const wchar_t *src, size_t n); wcswidth - determine columns needed for a fixed-size wide-character string #define _XOPEN_SOURCE /* See feature_test_macros(7) */ #include int wcswidth(const wchar_t *s, size_t n); wctob - try to represent a wide character as a single byte #include int wctob(wint_t c); wctomb - convert a wide character to a multibyte sequence #include int wctomb(char *s, wchar_t wc); wctrans - wide-character translation mapping #include wctrans_t wctrans(const char *name); wctype - wide-character classification #include wctype_t wctype(const char *name); wcwidth - determine columns needed for a wide character #define _XOPEN_SOURCE #include int wcwidth(wchar_t c); wmemchr - search a wide character in a wide-character array #include wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n); wmemcmp - compare two arrays of wide-characters #include int wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n); wmemcpy - copy an array of wide-characters #include wchar_t *wmemcpy(wchar_t *dest, const wchar_t *src, size_t n); wmemmove - copy an array of wide-characters #include wchar_t *wmemmove(wchar_t *dest, const wchar_t *src, size_t n); wmemset - fill an array of wide-characters with a constant wide charac‐ ter #include wchar_t *wmemset(wchar_t *wcs, wchar_t wc, size_t n); wordexp, wordfree - perform word expansion like a posix-shell #include int wordexp(const char *s, wordexp_t *p, int flags); void wordfree(wordexp_t *p); wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf - formatted wide-character output conversion #include #include int wprintf(const wchar_t *format, ...); int fwprintf(FILE *stream, const wchar_t *format, ...); int swprintf(wchar_t *wcs, size_t maxlen, const wchar_t *format, ...); int vwprintf(const wchar_t *format, va_list args); int vfwprintf(FILE *stream, const wchar_t *format, va_list args); int vswprintf(wchar_t *wcs, size_t maxlen, const wchar_t *format, va_list args); xencrypt, xdecrypt, passwd2des - RFS password encryption #include void passwd2des(char *passwd, char *key); int xencrypt(char *secret, char *passwd); int xdecrypt(char *secret, char *passwd); xdr - library routines for external data representation y0, y0f, y0l, y1, y1f, y1l, yn, ynf, ynl - Bessel functions of the sec‐ ond kind #include double y0(double x); double y1(double x); double yn(int n, double x); float y0f(float x); float y1f(float x); float ynf(int n, float x); long double y0l(long double x); long double y1l(long double x); long double ynl(int n, long double x); Link with -lm.