Open main menu

Wikibooks β

C Programming/POSIX Reference

< C Programming

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, 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.

C POSIX library header filesEdit

<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.
<grp.h> User group information and control.
<netdb.h> definitions for network database operations
<pthread.h> Defines an API for creating and manipulating POSIX threads.
<pwd.h> passwd (user information) access and control.
<spawn.h> Create a new process to run an executable program..
<sys/ipc.h> Inter-process communication (IPC).
<sys/mman.h> POSIX memory management declarations.
<sys/msg.h> POSIX message queues.
<sys/sem.h> POSIX semaphores.
<sys/stat.h> File information (stat et al.).
<sys/time.h> Time and date functions and structures.
<sys/types.h> Various data types used elsewhere.
<sys/utsname.h> uname and related structures.
<sys/wait.h> Status of terminated child processes
<tar.h> Magic numbers for the tar archive format.
<termios.h> Allows terminal I/O interfaces.
<unistd.h> Various essential POSIX functions and constants.
<utime.h> File access and modification times.