# C Programming/POSIX Reference

The C POSIX library is a language-independent library (using C calling conventions) that adds functions specific to POSIX systems. POSIX (and the Single Unix Specification) specifies a number of routines that should be available over and above those in the C standard library proper. It was developed at the same time as the ANSI C standard and is closely related to C. Some effort was made to make the C and POSIX libraries compatible, but there are a few POSIX functions that were never introduced into ANSI C.
Facilities are often implemented alongside the C standard library functionality, with varying degrees of closeness. For example, glibc implements functions such as fork within libc.so, but before NPTL was merged into glibc it constituted a separate library with its own linker flag. Often, this POSIX-specified functionality will be regarded as part of the library; the C library proper may be identified as the ANSI or ISO C library.

## Header files

| aio.h | Asynchronous input and output. |
| arpa/inet.h | Definitions for internet operations. |
| cpio.h | Magic numbers for the cpio archive format. |
| dirent.h | Allows the opening and listing of directories. |
| fcntl.h | File opening, locking and other operations. |
| fmtmsg.h | Message display structures. |
| fnmatch.h | Filename-matching types. |
| ftw.h | File tree traversal. |
| glob.h | Pathname pattern-matching types. |
| grp.h | User group information and control. |
| iconv.h | Codeset conversion facility. |
| langinfo.h | Language information constants. |
| libgen.h | Definitions for pattern matching functions. |
| monetary.h | Monetary types. |
| mqueue.h | Message queues (REALTIME). |
| ndbm.h | Definitions for ndbm database operations. |
| net/if.h | Sockets local interfaces. |
| netdb.h | Definitions for network database operations. |
| netinet/in.h | Internet address family. |
| netinet/tcp.h | Definitions for the Internet Transmission Control Protocol (TCP). |
| nl_types.h | Data types. |
| poll.h | Definitions for the poll function. |
| pthread.h | Defines an API for creating and manipulating POSIX threads. |
| pwd.h | Passwd (user information) access and control. |
| regex.h | Regular expression matching types. |
| sched.h | Execution scheduling. |
| search.h | Search tables. |
| semaphore.h | Semaphores. |
| spawn.h | Create a new process to run an executable program. |
| strings.h | String operations. |
| stropts.h | STREAMS interface (STREAMS). |
| sys/ipc.h | Inter-process communication (IPC). |
| sys/mman.h | POSIX memory management declarations. |
| sys/msg.h | POSIX message queues. |
| sys/resource.h | Definitions for XSI resource operations. |
| sys/select.h | Select types. |
| sys/sem.h | POSIX semaphores. |
| sys/shm.h | XSI shared memory facility. |
| sys/socket.h | Main sockets header. |
| sys/stat.h | File information (stat et al.). |
| sys/statvfs.h | VFS File System information structure. |
| sys/time.h | Time and date functions and structures. |
| sys/times.h | File access and modification times structure. |
| sys/types.h | Various data types used elsewhere. |
| sys/uio.h | Definitions for vector I/O operations. |
| sys/un.h | Definitions for UNIX domain sockets. |
| sys/utsname.h | uname and related structures. |
| sys/wait.h | Status of terminated child processes. |
| syslog.h | Definitions for system error logging. |
| tar.h | Magic numbers for the tar archive format. |
| termios.h | Allows terminal I/O interfaces. |
| trace.h | Tracing. |
| ulimit.h | ulimit commands. |
| unistd.h | Various essential POSIX functions and constants. |
| utime.h | File access and modification times. |
| utmpx.h | User accounting database definitions. |
| wordexp.h | Word-expansion types. |

## Standard overlap headers

Headers that overlap/extend the C standard.
| assert.h | Verify program assertion. |
| complex.h | Complex arithmetic. |
| ctype.h | Character types. |
| fenv.h | Floating-point environment. |
| float.h | Floating types. |
| inttypes.h | Fixed size integer types. |
| iso646.h | Alternative spellings. |
| limits.h | Implementation-defined constants. |
| locale.h | Category macros. |
| math.h | Mathematical declarations. |
| setjmp.h | Stack environment declarations. |
| signal.h | Signals. |
| stdarg.h | Handle variable argument list. |
| stdbool.h | Boolean type and values. |
| stddef.h | Standard type definitions. |
| stdint.h | Integer types. |
| stdio.h | Standard buffered input/output. |
| stdlib.h | Standard library definitions. |
| string.h | String operations. |
| tgmath.h | Type-generic macros. |
| time.h | Time types. |
| wchar.h | Wide-character handling. |
| wctype.h | Wide-character classification and mapping utilities. |

## References

* Official List of headers in the POSIX library on opengroup.org
* Lists headers in the POSIX library
* Description of the posix library from the Flux OSKit

## Bibliography

* Gallmeister, Bill (January 1, 1995), POSIX.4 Programmers Guide: Programming for the Real World (1st ed.), O'Reilly Media, p. 564, ISBN 1565920740