C Programming/POSIX Reference

From Wikibooks, open books for an open world
Jump to: navigation, search

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.

C POSIX library header files[edit]

Header file Description
<aio.h> Asynchronous input and output
<arpa/inet.h> Functions for manipulating numeric IP addresses (part of Berkeley sockets)
<assert.h> Verify assumptions
<complex.h> Complex Arithmetic
<cpio.h> Magic numbers for the cpio archive format
<ctype.h> Character types
<dirent.h> Allows the opening and listing of directories
<dlfcn.h> Dynamic linking
<errno.h> Retrieving Error Number
<fcntl.h> File opening, locking and other operations
<fenv.h> Floating-Point Environment (FPE)
<float.h> Floating-point types, see the C data types section
<fmtmsg.h> Message display structures
<fnmatch.h> Filename matching
<ftw.h> File tree traversal
<glob.h> Pathname "globbing" (pattern-matching)
<grp.h> User group information and control
<iconv.h> Codeset conversion facility
<inttypes.h> Fixed sized integer types, see the C data types section
<iso646.h> Alternative spellings
<langinfo.h> Language information constants – builds on C localization functions
<libgen.h> Pathname manipulation
<limits.h> Implementation-defined constants, see the C data types section
<locale.h> Category macros
<math.h> Mathematical declarations
<monetary.h> String formatting of monetary units
<mqueue.h> Message queue
<ndbm.h> NDBM database operations
<net/if.h> Listing of local network interfaces
<netdb.h> Translating protocol and host names into numeric addresses (part of Berkeley sockets)
<netinet/in.h> Defines Internet protocol and address family (part of Berkeley sockets)
<netinet/tcp.h> Additional TCP control options (part of Berkeley sockets)
<nl_types.h> Localization message catalog functions
<poll.h> Asynchronous file descriptor multiplexing
<pthread.h> Defines an API for creating and manipulating POSIX threads
<pwd.h> Passwd (user information) access and control
<regex.h> Regular expression matching
<sched.h> Execution scheduling
<search.h> Search tables
<semaphore.h> POSIX semaphores
<setjmp.h> Stack environment declarations
<signal.h> Signals
<spawn.h> Process spawning
<stdint.h> Integer types, see the C data types section
<string.h> Several String Operations, see the String Manipulation section
<strings.h> Case-insensitive string comparisons
<stropts.h> Stream manipulation, including ioctl
<sys/ipc.h> Inter-process communication (IPC)
<sys/mman.h> Memory management, including POSIX shared memory and memory mapped files
<sys/msg.h> POSIX message queues
<sys/resource.h> Resource usage, priorities, and limiting
<sys/select.h> Synchronous I/O multiplexing
<sys/sem.h> XSI (SysV style) semaphores
<sys/shm.h> XSI (SysV style) shared memory
<sys/socket.h> Main Berkley sockets header
<sys/stat.h> File information (stat et al.)
<sys/statvfs.h> File System information
<sys/time.h> Time and date functions and structures
<sys/times.h> File access and modification times
<sys/types.h> Various data types used elsewhere
<sys/uio.h> Vectored I/O operations
<sys/un.h> Unix domain sockets
<sys/utsname.h> Operating system information, including uname
<sys/wait.h> Status of terminated child processes
<syslog.h> System error logging
<tar.h> Magic numbers for the tar archive format
<termios.h> Allows terminal I/O interfaces
<tgmath.h> Type-Generic Macros
<time.h> Type-Generic Macros
<trace.h> Tracing of runtime behavior (DEPRECATED)
<ulimit.h> Resource limiting (DEPRECATED in favor of <sys/resource.h>)
<unistd.h> Various essential POSIX functions and constants
<utime.h> inode access and modification times
<utmpx.h> User accounting database functions
<wchar.h> Wide-Character Handling, see the String Manipulation section
<wctype.h> Wide-Character Classification and Mapping Utilities
<wordexp.h> Word-expansion like the shell would perform

References[edit]

Bibliography[edit]