Skip to content

ghshhf/public-apis

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4,864 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glibc — 公共 API 索引

glibc (GNU C Library) 为根本的公共 API 索引。本仓库手工维护,按照功能模块分类,列出 C 库提供的核心函数、头文件与线程安全属性,供系统编程时快速查阅。

本项目以 public-apis 项目的文档格式规范为参考。所有 API 条目统一以 5 列表格呈现:Function | Header | Description | Standard | MT-Safe



Index



Standard I/O (stdio.h)

Stream Open/Close

Function Header Description Standard MT-Safe
fopen <stdio.h> Open a file and associate a stream with it POSIX.1-2001, C89 Yes
freopen <stdio.h> Open the file whose name is the string pointed to by pathname and associates the stream pointed to by stream with it POSIX.1-2001, C89 Yes
fdopen <stdio.h> Associate a stream with an existing file descriptor POSIX.1-2001, POSIX.1-2008 Yes
fclose <stdio.h> Flush and close a stream POSIX.1-2001, C89 Yes
fileno <stdio.h> Examine the argument stream and return its integer file descriptor POSIX.1-2001, POSIX.1-2008 Yes

Formatted I/O

Function Header Description Standard MT-Safe
printf <stdio.h> Write formatted output to stdout POSIX.1-2001, C89 Yes
fprintf <stdio.h> Write formatted output to the given stream POSIX.1-2001, C89 Yes
sprintf <stdio.h> Write formatted output to a character array POSIX.1-2001, C89 Yes
snprintf <stdio.h> Write formatted output to a character array with size limit POSIX.1-2001, C99 Yes
scanf <stdio.h> Read formatted input from stdin POSIX.1-2001, C89 Yes
fscanf <stdio.h> Read formatted input from the given stream POSIX.1-2001, C89 Yes
sscanf <stdio.h> Read formatted input from a character array POSIX.1-2001, C89 Yes
vprintf <stdio.h> Equivalent to printf with variable argument list POSIX.1-2001, C89 Yes
vfprintf <stdio.h> Equivalent to fprintf with variable argument list POSIX.1-2001, C89 Yes
vsprintf <stdio.h> Equivalent to sprintf with variable argument list POSIX.1-2001, C89 Yes
vsnprintf <stdio.h> Equivalent to snprintf with variable argument list POSIX.1-2001, C99 Yes
perror <stdio.h> Print a message describing the error code in errno POSIX.1-2001, C89 Yes

Character & String I/O

Function Header Description Standard MT-Safe
fgetc <stdio.h> Read the next character from stream and return it as unsigned char cast to int POSIX.1-2001, C89 Yes
getc <stdio.h> Equivalent to fgetc except that it may be implemented as a macro POSIX.1-2001, C89 Yes
getchar <stdio.h> Equivalent to getc(stdin) POSIX.1-2001, C89 Yes
ungetc <stdio.h> Push c back to stream, cast to unsigned char, where it is available for subsequent read operations POSIX.1-2001, C89 Yes
fputc <stdio.h> Write the character c, cast to unsigned char, to stream POSIX.1-2001, C89 Yes
putc <stdio.h> Equivalent to fputc except that it may be implemented as a macro POSIX.1-2001, C89 Yes
putchar <stdio.h> Equivalent to putc(c, stdout) POSIX.1-2001, C89 Yes
fgets <stdio.h> Read in at most one less than size characters from stream POSIX.1-2001, C89 Yes
fputs <stdio.h> Write the string s to stream, without its terminating null byte POSIX.1-2001, C89 Yes
gets <stdio.h> Read a line from stdin into the buffer pointed to by s until either a terminating newline or EOF, which it replaces with a null byte POSIX.1-2001 (removed in C11) Yes

Binary I/O

Function Header Description Standard MT-Safe
fread <stdio.h> Read nmemb items of data, each size bytes long, from the stream pointed to by stream POSIX.1-2001, C89 Yes
fwrite <stdio.h> Write nmemb items of data, each size bytes long, to the stream pointed to by stream POSIX.1-2001, C89 Yes

File Positioning

Function Header Description Standard MT-Safe
fseek <stdio.h> Set the file position indicator for the stream pointed to by stream POSIX.1-2001, C89 Yes
ftell <stdio.h> Obtain the current value of the file position indicator for the stream POSIX.1-2001, C89 Yes
fsetpos <stdio.h> Set the file position indicator for the stream to value of fpos_t POSIX.1-2001, C89 Yes
fgetpos <stdio.h> Store the current value of the file position indicator POSIX.1-2001, C89 Yes
rewind <stdio.h> Move the file position to the beginning of the file POSIX.1-2001, C89 Yes

Stream Buffering

Function Header Description Standard MT-Safe
fflush <stdio.h> Flush a stream; if NULL make sure all pending writes complete POSIX.1-2001, C89 Yes
setvbuf <stdio.h> Set the buffering mode and optionally the buffer size for a stream POSIX.1-2001, C89 Yes
setbuf <stdio.h> Set the buffer to be used for I/O operations on the stream POSIX.1-2001, C89 Yes
setbuffer <stdio.h> Set the buffer to be used for a stream (BSD) BSD, SVID Yes
setlinebuf <stdio.h> Set line buffering for stream 4.2BSD, SVID Yes

File Operations

Function Header Description Standard MT-Safe
remove <stdio.h> Delete a name and possibly the file it refers to POSIX.1-2001, C89 Yes
rename <stdio.h> Change the name or location of a file POSIX.1-2001, C89 Yes
tmpfile <stdio.h> Create a temporary file in binary read/write (w+b) mode POSIX.1-2001, C89 Yes
tmpnam <stdio.h> Return a pointer to a string that is a valid filename POSIX.1-2001, C89 No (race:tmpnam)
tempnam <stdio.h> Return a pointer to a string that is a valid filename, in directory dir if non-NULL POSIX.1-2001 Yes
mkstemp <stdlib.h> Create a unique temporary file from template POSIX.1-2001, 4.3BSD Yes
mkdtemp <stdlib.h> Create a unique temporary directory from template POSIX.1-2008 Yes

File Descriptor I/O (unistd.h, fcntl.h)

Function Header Description Standard MT-Safe
open <fcntl.h> Open and possibly create a file POSIX.1-2001 Yes
openat <fcntl.h> Equivalent to open except when pathname is relative, resolves it relative to directory referred to by dirfd POSIX.1-2008 Yes
creat <fcntl.h> Create a new file or rewrite an existing one POSIX.1-2001 Yes
close <unistd.h> Close a file descriptor POSIX.1-2001 Yes
read <unistd.h> Read up to count bytes from file descriptor fd into buf POSIX.1-2001 Yes
write <unistd.h> Write up to count bytes from buffer buf to file descriptor fd POSIX.1-2001 Yes
pread <unistd.h> Read from a file descriptor at an offset without changing the file offset POSIX.1-2001 Yes
pwrite <unistd.h> Write to a file descriptor at an offset without changing the file offset POSIX.1-2001 Yes
readv <sys/uio.h> Read data into multiple buffers POSIX.1-2001 Yes
writev <sys/uio.h> Write data from multiple buffers POSIX.1-2001 Yes
preadv <sys/uio.h> Read from a file descriptor into multiple buffers at a given offset POSIX.1-2008, Linux Yes
pwritev <sys/uio.h> Write to a file descriptor from multiple buffers at a given offset POSIX.1-2008, Linux Yes
lseek <unistd.h> Reposition read/write file offset POSIX.1-2001 Yes
dup <unistd.h> Allocate a new file descriptor that refers to the same open file description POSIX.1-2001 Yes
dup2 <unistd.h> Same as dup, the new file descriptor uses the specified number POSIX.1-2001 Yes
dup3 <unistd.h> Same as dup2, but with additional flags Linux Yes
fcntl <fcntl.h> Manipulate file descriptor POSIX.1-2001 Yes
ioctl <sys/ioctl.h> Device control operations POSIX.1-2001 Yes
pipe <unistd.h> Create pipe POSIX.1-2001 Yes
pipe2 <fcntl.h> Create pipe with flags Linux Yes

Error/Status

Function Header Description Standard MT-Safe
feof <stdio.h> Test the end-of-file indicator for the stream POSIX.1-2001, C89 Yes
ferror <stdio.h> Test the error indicator for the stream POSIX.1-2001, C89 Yes
clearerr <stdio.h> Clear the end-of-file and error indicators for the stream POSIX.1-2001, C89 Yes


Character & String (string.h, ctype.h)

Character Classification

Function Header Description Standard MT-Safe
isalnum <ctype.h> Check for an alphanumeric character POSIX.1-2001, C89 Yes
isalpha <ctype.h> Check for an alphabetic character POSIX.1-2001, C89 Yes
isascii <ctype.h> Check whether c is a 7-bit unsigned char value that fits into the ASCII character set BSD, POSIX.1-2001 Yes
isblank <ctype.h> Check for a blank character; that is, a space or a tab POSIX.1-2001, C99 Yes
iscntrl <ctype.h> Check for a control character POSIX.1-2001, C89 Yes
isdigit <ctype.h> Check for a digit (0 through 9) POSIX.1-2001, C89 Yes
isgraph <ctype.h> Check for any printable character except space POSIX.1-2001, C89 Yes
islower <ctype.h> Check for a lowercase character POSIX.1-2001, C89 Yes
isprint <ctype.h> Check for any printable character including space POSIX.1-2001, C89 Yes
ispunct <ctype.h> Check for any printable character which is not a space or an alphanumeric character POSIX.1-2001, C89 Yes
isspace <ctype.h> Check for white-space characters POSIX.1-2001, C89 Yes
isupper <ctype.h> Check for an uppercase letter POSIX.1-2001, C89 Yes
isxdigit <ctype.h> Check for hexadecimal digits POSIX.1-2001, C89 Yes
tolower <ctype.h> Convert c to lowercase if possible POSIX.1-2001, C89 Yes
toupper <ctype.h> Convert c to uppercase if possible POSIX.1-2001, C89 Yes

String Operations

Function Header Description Standard MT-Safe
strcpy <string.h> Copy the string pointed to by src, including the terminating null byte POSIX.1-2001, C89 Yes
strncpy <string.h> Copy at most n bytes of src to dest POSIX.1-2001, C89 Yes
strcat <string.h> Append the src string to the dest string POSIX.1-2001, C89 Yes
strncat <string.h> Append at most n bytes of src to dest POSIX.1-2001, C89 Yes
strcmp <string.h> Compare the two strings s1 and s2 POSIX.1-2001, C89 Yes
strncmp <string.h> Compare the two strings s1 and s2, comparing at most n bytes POSIX.1-2001, C89 Yes
strcasecmp <strings.h> Compare two strings ignoring case POSIX.1-2001, 4.4BSD Yes
strncasecmp <strings.h> Compare two strings ignoring case, at most n bytes POSIX.1-2001, 4.4BSD Yes
strcoll <string.h> Compare two strings according to the current locale POSIX.1-2001, C89 Yes
strxfrm <string.h> Transform src string so result of strcmp on two transformed strings gives same result as strcoll on originals POSIX.1-2001, C89 Yes
strchr <string.h> Return a pointer to the first occurrence of the character c in the string s POSIX.1-2001, C89 Yes
strrchr <string.h> Return a pointer to the last occurrence of the character c in the string s POSIX.1-2001, C89 Yes
strpbrk <string.h> Locate the first occurrence in the string s of any of the bytes in the string accept POSIX.1-2001, C89 Yes
strcspn <string.h> Get length of a prefix substring consisting of bytes not in reject POSIX.1-2001, C89 Yes
strspn <string.h> Get length of a prefix substring consisting of bytes in accept POSIX.1-2001, C89 Yes
strstr <string.h> Finds the first occurrence of the substring needle in the string haystack POSIX.1-2001, C89 Yes
strtok <string.h> Extract tokens from strings POSIX.1-2001, C89 No (race:strtok)
strtok_r <string.h> Reentrant version of strtok POSIX.1-2001, C99 Yes
strlen <string.h> Calculate the length of the string pointed to by s, excluding the terminating null byte POSIX.1-2001, C89 Yes
strnlen <string.h> Determine the length of the string pointed to by s, excluding the terminating null byte, but not beyond n POSIX.1-2008 Yes
strdup <string.h> Return a pointer to a new string which is a duplicate of the string s POSIX.1-2001 Yes
strndup <string.h> Return a pointer to a new string which is a duplicate of the string s, but not more than n bytes POSIX.1-2008 Yes
strerror <string.h> Return a pointer to the textual representation of the current errno code POSIX.1-2001, C89 No (race:strerror locale)
strerror_r <string.h> Reentrant version of strerror POSIX.1-2001 Yes
strsignal <string.h> Return string describing signal number POSIX.1-2008 Yes
strfmon <monetary.h> Format a monetary value according to the locale POSIX.1-2008 Yes

Memory Operations

Function Header Description Standard MT-Safe
memcpy <string.h> Copy n bytes from memory area src to memory area dest POSIX.1-2001, C89 Yes
memmove <string.h> Copy n bytes from src to dest; the memory areas may overlap POSIX.1-2001, C89 Yes
memset <string.h> Fill the first n bytes of the memory area pointed to by s with the constant byte c POSIX.1-2001, C89 Yes
memchr <string.h> Scan the initial n bytes of the memory area pointed to by s for the first instance of c POSIX.1-2001, C89 Yes
memrchr <string.h> Scan the n bytes of the memory area s for the last instance of c GNU Yes
memcmp <string.h> Compare the first n bytes (each interpreted as unsigned char) of the memory areas s1 and s2 POSIX.1-2001, C89 Yes
bcopy <strings.h> Copy n bytes from src to dest 4.3BSD Yes
bzero <strings.h> Set the first n bytes of the byte area starting at s to zero 4.3BSD Yes
bcmp <strings.h> Compare the first n bytes of the two byte areas s1 and s2 4.3BSD Yes
swab <string.h> Swap adjacent bytes POSIX.1-2001 Yes


Memory Management (stdlib.h, sys/mman.h)

Dynamic Memory Allocation

Function Header Description Standard MT-Safe
malloc <stdlib.h> Allocate size bytes and return a pointer to the allocated memory POSIX.1-2001, C89 Yes
calloc <stdlib.h> Allocate memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory POSIX.1-2001, C89 Yes
realloc <stdlib.h> Change the size of the memory block pointed to by ptr to size bytes POSIX.1-2001, C89 Yes
reallocarray <stdlib.h> Reallocate array, same as realloc(nmemb*size) with overflow protection GNU Yes
free <stdlib.h> Frees the memory space pointed to by ptr POSIX.1-2001, C89 Yes
posix_memalign <stdlib.h> Allocate aligned memory, aligned to a boundary that is a multiple of alignment POSIX.1-2001 Yes
aligned_alloc <stdlib.h> Allocate size bytes of memory aligned to alignment C11, POSIX.1-2008 Yes
memalign <stdlib.h> Allocate size bytes and return a pointer to the allocated memory; memory address is a multiple of alignment BSD, SVID Yes
valloc <stdlib.h> Allocates size bytes and returns a pointer to the allocated memory; memory address is a multiple of the page size BSD Yes
pvalloc <stdlib.h> Allocate size bytes and returns a pointer to the allocated memory; size is rounded up to next multiple of page size GNU Yes
mallopt <malloc.h> Set tunable parameters that affect the behavior of malloc GNU Yes
malloc_stats <malloc.h> Print (on stderr) statistics about calls to malloc and free GNU Yes
malloc_trim <malloc.h> Release free pages from the top of the heap GNU Yes
malloc_usable_size <malloc.h> Obtain size of block of memory allocated with malloc GNU Yes
mtrace <mcheck.h> Install handlers for tracing memory allocation and deallocation GNU Yes
muntrace <mcheck.h> Turn off memory tracing GNU Yes
mallinfo <malloc.h> Returns a copy of the malloc internal bookkeeping information GNU Yes
mallinfo2 <malloc.h> Like mallinfo but with larger fields to handle modern memory sizes GNU Yes
mcheck <mcheck.h> Consistency check for malloc GNU Yes
mprobe <mcheck.h> Check consistency of block pointed to by ptr GNU Yes
alloca <alloca.h> Allocate memory that is automatically freed when the function that called alloca returns BSD, GNU Yes

Memory-mapped Files

Function Header Description Standard MT-Safe
mmap <sys/mman.h> Map files or devices into memory POSIX.1-2001 Yes
munmap <sys/mman.h> Unmap files or devices from memory POSIX.1-2001 Yes
mprotect <sys/mman.h> Set protection on a region of memory POSIX.1-2001 Yes
msync <sys/mman.h> Synchronize a file with a memory map POSIX.1-2001 Yes
mlock <sys/mman.h> Lock part of the calling process virtual address space into RAM POSIX.1-2001 Yes
mlock2 <sys/mman.h> Lock part of the calling process virtual address space into RAM with flags Linux Yes
munlock <sys/mman.h> Unlock pages in the specified address range POSIX.1-2001 Yes
mlockall <sys/mman.h> Lock all pages mapped into the address space of the calling process POSIX.1-2001 Yes
munlockall <sys/mman.h> Unlock all pages mapped into the address space of the calling process POSIX.1-2001 Yes
madvise <sys/mman.h> Give advice about use of memory POSIX.1-2001 Yes
posix_madvise <sys/mman.h> Give advice about use of memory, same as madvise but different return value POSIX.1-2001 Yes
mincore <sys/mman.h> Determine whether pages are resident in memory POSIX.1-2001 Yes
mremap <sys/mman.h> Remap a virtual memory address, expand or shrink Linux Yes
remap_file_pages <sys/mman.h> Create a nonlinear mapping Linux Yes
shm_open <sys/mman.h> Open a POSIX shared memory object POSIX.1-2001 Yes
shm_unlink <sys/mman.h> Remove a POSIX shared memory object POSIX.1-2001 Yes

Program Address Space

Function Header Description Standard MT-Safe
sbrk <unistd.h> Change data segment size BSD, SUSv1 Yes
brk <unistd.h> Change the location of the program break BSD, SUSv1 Yes
getpagesize <unistd.h> Get memory page size POSIX.1-2001 Yes
sysconf <unistd.h> Get configuration information at runtime (including _SC_PAGESIZE) POSIX.1-2001 Yes


Math Library (math.h)

Basic Math Functions

Function Header Description Standard MT-Safe
abs <stdlib.h> Compute the absolute value of the integer argument POSIX.1-2001, C89 Yes
labs <stdlib.h> Compute the absolute value of the long integer argument POSIX.1-2001, C89 Yes
llabs <stdlib.h> Compute the absolute value of the long long integer argument POSIX.1-2001, C99 Yes
imaxabs <inttypes.h> Compute the absolute value of the intmax_t argument POSIX.1-2001, C99 Yes
fabs <math.h> Compute the absolute value of the floating-point number x POSIX.1-2001, C89 Yes
fabsf <math.h> Compute the absolute value of the float number x POSIX.1-2001, C99 Yes
fabsl <math.h> Compute the absolute value of the long double number x POSIX.1-2001, C99 Yes
div <stdlib.h> Compute the quotient and remainder of the division of the numerator by denominator POSIX.1-2001, C89 Yes
ldiv <stdlib.h> Same as div but with long arguments POSIX.1-2001, C89 Yes
lldiv <stdlib.h> Same as div but with long long arguments POSIX.1-2001, C99 Yes
imaxdiv <inttypes.h> Same as div but with intmax_t arguments POSIX.1-2001, C99 Yes

Trigonometric Functions

Function Header Description Standard MT-Safe
sin <math.h> Sine function POSIX.1-2001, C89 Yes
cos <math.h> Cosine function POSIX.1-2001, C89 Yes
tan <math.h> Tangent function POSIX.1-2001, C89 Yes
asin <math.h> Arc sine function POSIX.1-2001, C89 Yes
acos <math.h> Arc cosine function POSIX.1-2001, C89 Yes
atan <math.h> Arc tangent function POSIX.1-2001, C89 Yes
atan2 <math.h> Arc tangent function of two variables POSIX.1-2001, C89 Yes
sinh <math.h> Hyperbolic sine function POSIX.1-2001, C89 Yes
cosh <math.h> Hyperbolic cosine function POSIX.1-2001, C89 Yes
tanh <math.h> Hyperbolic tangent function POSIX.1-2001, C89 Yes
asinh <math.h> Inverse hyperbolic sine function POSIX.1-2001, C99 Yes
acosh <math.h> Inverse hyperbolic cosine function POSIX.1-2001, C99 Yes
atanh <math.h> Inverse hyperbolic tangent function POSIX.1-2001, C99 Yes

Exponential & Logarithmic Functions

Function Header Description Standard MT-Safe
exp <math.h> Exponential function (e^x) POSIX.1-2001, C89 Yes
exp2 <math.h> Base-2 exponential function (2^x) POSIX.1-2001, C99 Yes
expm1 <math.h> Exponential minus 1 (e^x - 1) POSIX.1-2001, C99 Yes
log <math.h> Natural logarithm function (ln x) POSIX.1-2001, C89 Yes
log2 <math.h> Base-2 logarithm function (log2 x) POSIX.1-2001, C99 Yes
log10 <math.h> Base-10 logarithm function (log10 x) POSIX.1-2001, C89 Yes
log1p <math.h> Natural logarithm of 1 plus argument (ln(1+x)) POSIX.1-2001, C99 Yes
logb <math.h> Extract exponent of the floating-point number POSIX.1-2001, C99 Yes
ilogb <math.h> Return integer part of the exponent of x POSIX.1-2001, C99 Yes
pow <math.h> Power function (x^y) POSIX.1-2001, C89 Yes
sqrt <math.h> Non-negative square root function POSIX.1-2001, C89 Yes
cbrt <math.h> Cube root function POSIX.1-2001, C99 Yes
hypot <math.h> Euclidean distance function sqrt(x^2 + y^2) POSIX.1-2001, C89 Yes

Rounding & Remainder Functions

Function Header Description Standard MT-Safe
ceil <math.h> Smallest integral value not less than x POSIX.1-2001, C89 Yes
floor <math.h> Largest integral value not greater than x POSIX.1-2001, C89 Yes
trunc <math.h> Round to integer, toward zero POSIX.1-2001, C99 Yes
round <math.h> Round to nearest integer, away from zero POSIX.1-2001, C99 Yes
lround <math.h> Round to nearest integer, away from zero; return long POSIX.1-2001, C99 Yes
llround <math.h> Round to nearest integer, away from zero; return long long POSIX.1-2001, C99 Yes
nearbyint <math.h> Round to integer in current rounding direction POSIX.1-2001, C99 Yes
rint <math.h> Round to integer in current rounding direction, raise inexact exception POSIX.1-2001, C89 Yes
lrint <math.h> Round to integer in current rounding direction, return long POSIX.1-2001, C99 Yes
llrint <math.h> Round to integer in current rounding direction, return long long POSIX.1-2001, C99 Yes
fmod <math.h> Floating-point remainder function POSIX.1-2001, C89 Yes
remainder <math.h> IEEE remainder function POSIX.1-2001, C89 Yes
remquo <math.h> Compute remainder and part of quotient POSIX.1-2001, C99 Yes
modf <math.h> Break x into fractional and integer parts POSIX.1-2001, C89 Yes
frexp <math.h> Convert floating-point number to fractional and integral components POSIX.1-2001, C89 Yes
ldexp <math.h> Multiply floating-point number by integral power of 2 POSIX.1-2001, C89 Yes
scalbn <math.h> Multiply floating-point number by integral power of FLT_RADIX POSIX.1-2001, C89 Yes
scalbln <math.h> Multiply floating-point number by integral power of FLT_RADIX, using long exponent POSIX.1-2001, C99 Yes

Classification & Comparison

Function Header Description Standard MT-Safe
isnan <math.h> Determine whether floating-point value is not a number POSIX.1-2001, C99 Yes
isinf <math.h> Determine whether floating-point value is infinite POSIX.1-2001, C99 Yes
isfinite <math.h> Determine whether floating-point value is a finite number POSIX.1-2001, C99 Yes
signbit <math.h> Test the sign bit of the floating-point value POSIX.1-2001, C99 Yes
fpclassify <math.h> Classify real floating type POSIX.1-2001, C99 Yes
isnormal <math.h> Test whether value is a normal number POSIX.1-2001, C99 Yes
copysign <math.h> Copy sign of a number POSIX.1-2001, C99 Yes
nextafter <math.h> Next representable floating-point value POSIX.1-2001, C99 Yes
nexttoward <math.h> Next representable floating-point value toward x in the direction of y POSIX.1-2001, C99 Yes
nan <math.h> Return quiet NaN POSIX.1-2001, C99 Yes
fmax <math.h> Determine maximum of two floating-point numbers POSIX.1-2001, C99 Yes
fmin <math.h> Determine minimum of two floating-point numbers POSIX.1-2001, C99 Yes
fdim <math.h> Compute positive difference of two floating-point numbers POSIX.1-2001, C99 Yes
fma <math.h> Floating-point multiply and add POSIX.1-2001, C99 Yes

Error & Special Functions

Function Header Description Standard MT-Safe
erf <math.h> Error function POSIX.1-2001, C99 Yes
erfc <math.h> Complementary error function POSIX.1-2001, C99 Yes
lgamma <math.h> Natural logarithm of the absolute value of the gamma function POSIX.1-2001, C99 Yes
tgamma <math.h> True gamma function POSIX.1-2001, C99 Yes
j0 <math.h> Bessel function of the first kind, order 0 POSIX.1-2001 Yes
j1 <math.h> Bessel function of the first kind, order 1 POSIX.1-2001 Yes
jn <math.h> Bessel function of the first kind, order n POSIX.1-2001 Yes
y0 <math.h> Bessel function of the second kind, order 0 POSIX.1-2001 Yes
y1 <math.h> Bessel function of the second kind, order 1 POSIX.1-2001 Yes
yn <math.h> Bessel function of the second kind, order n POSIX.1-2001 Yes

Floating-Point Environment

Function Header Description Standard MT-Safe
feclearexcept <fenv.h> Clear the supported exceptions represented by the excepts argument POSIX.1-2001, C99 Yes
fegetexceptflag <fenv.h> Store implementation-defined representation of the exception flags POSIX.1-2001, C99 Yes
feraiseexcept <fenv.h> Raise the supported floating-point exceptions represented by excepts POSIX.1-2001, C99 Yes
fesetexceptflag <fenv.h> Set complete status flags POSIX.1-2001, C99 Yes
fetestexcept <fenv.h> Determine which of a specified subset of the floating-point exception flags are currently set POSIX.1-2001, C99 Yes
fegetround <fenv.h> Get the rounding direction POSIX.1-2001, C99 Yes
fesetround <fenv.h> Set the rounding direction POSIX.1-2001, C99 Yes
fegetenv <fenv.h> Get the floating-point environment POSIX.1-2001, C99 Yes
feholdexcept <fenv.h> Save the current floating-point environment POSIX.1-2001, C99 Yes
fesetenv <fenv.h> Establish the floating-point environment represented by envp POSIX.1-2001, C99 Yes
feupdateenv <fenv.h> Update the floating-point environment POSIX.1-2001, C99 Yes


Time & Date (time.h, sys/time.h)

Time Functions

Function Header Description Standard MT-Safe
time <time.h> Return the time as seconds since the Epoch (00:00:00 UTC, January 1, 1970) POSIX.1-2001, C89 Yes
gettimeofday <sys/time.h> Get the time (seconds and microseconds) POSIX.1-2001, 4.3BSD Yes
settimeofday <sys/time.h> Set the system time POSIX.1-2001, 4.3BSD Yes
clock_gettime <time.h> Find the resolution (precision) of the specified clock clk_id POSIX.1-2001 Yes
clock_getres <time.h> Find the resolution of the specified clock POSIX.1-2001 Yes
clock_settime <time.h> Set the time of the specified clock POSIX.1-2001 Yes
clock <time.h> Approximate processor time used by the program POSIX.1-2001, C89 Yes
times <sys/times.h> Return the current process times POSIX.1-2001, C89 Yes
difftime <time.h> Calculate the difference between two times POSIX.1-2001, C89 Yes
mktime <time.h> Convert a broken-down time structure to time_t (local time) POSIX.1-2001, C89 Yes
nanosleep <time.h> High-resolution sleep POSIX.1 Yes

Date & Time Formatting

Function Header Description Standard MT-Safe
strftime <time.h> Format broken-down time into a string according to format specification POSIX.1-2001, C89 Yes
strptime <time.h> Convert a string representation of time to a time tm structure POSIX.1-2001 Yes
asctime <time.h> Convert broken-down time to a string POSIX.1-2001, C89 Yes
asctime_r <time.h> Reentrant version of asctime POSIX.1-2001, C89 Yes
ctime <time.h> Convert calendar time to a string POSIX.1-2001, C89 Yes
ctime_r <time.h> Reentrant version of ctime POSIX.1-2001 Yes
gmtime <time.h> Convert calendar time to broken-down time (UTC) POSIX.1-2001, C89 Yes
gmtime_r <time.h> Reentrant version of gmtime POSIX.1-2001 Yes
localtime <time.h> Convert calendar time to broken-down time (local timezone) POSIX.1-2001, C89 Yes
localtime_r <time.h> Reentrant version of localtime POSIX.1-2001 Yes
tzset <time.h> Initialize time conversion information using the TZ environment variable POSIX.1-2001, C89 Yes

Timers

Function Header Description Standard MT-Safe
timer_create <time.h> Create a POSIX per-process timer POSIX.1-2001 Yes
timer_delete <time.h> Delete a POSIX per-process timer POSIX.1-2001 Yes
timer_getoverrun <time.h> Get the timer overrun count POSIX.1-2001 Yes
timer_gettime <time.h> Fetch the timer current value and interval POSIX.1-2001 Yes
timer_settime <time.h> Arm or disarm a timer POSIX.1-2001 Yes
setitimer <sys/time.h> Set the value of an interval timer POSIX.1-2001, 4.3BSD Yes
getitimer <sys/time.h> Get the value of an interval timer POSIX.1-2001, 4.3BSD Yes
alarm <unistd.h> Arrange for a SIGALRM signal to be delivered to the calling process POSIX.1-2001 Yes
sleep <unistd.h> Sleep for the specified number of seconds POSIX.1-2001 Yes
usleep <unistd.h> Suspend execution for microsecond intervals 4.3BSD Yes


File System (unistd.h, sys/stat.h, fcntl.h, dirent.h)

File Information

Function Header Description Standard MT-Safe
stat <sys/stat.h> Obtain information about a file POSIX.1-2001 Yes
fstat <sys/stat.h> Obtain information about a file via file descriptor POSIX.1-2001 Yes
lstat <sys/stat.h> Obtain information about a file or symbolic link POSIX.1-2001 Yes
statx <sys/stat.h> Get file status (extended) Linux Yes
access <unistd.h> Check real user's permissions for a file POSIX.1-2001 Yes
faccessat <unistd.h> Check permissions of a file relative to a directory file descriptor POSIX.1-2008 Yes
umask <sys/stat.h> Set the file mode creation mask POSIX.1-2001 Yes

File Operations

Function Header Description Standard MT-Safe
unlink <unistd.h> Remove a file or directory POSIX.1-2001 Yes
unlinkat <unistd.h> Remove a file or directory relative to a directory file descriptor POSIX.1-2008 Yes
rename <stdio.h> Change the name or location of a file POSIX.1-2001 Yes
renameat <stdio.h> Change the name or location of a file relative to directory file descriptors POSIX.1-2008 Yes
link <unistd.h> Create a new hard link to an existing file POSIX.1-2001 Yes
linkat <unistd.h> Create a link relative to directory file descriptors POSIX.1-2008 Yes
symlink <unistd.h> Create a symbolic link POSIX.1-2001 Yes
symlinkat <unistd.h> Create a symbolic link relative to a directory file descriptor POSIX.1-2008 Yes
readlink <unistd.h> Read the target of a symbolic link POSIX.1-2001 Yes
readlinkat <unistd.h> Read the target of a symbolic link relative to a directory file descriptor POSIX.1-2008 Yes
truncate <unistd.h> Truncate a file to a specified length POSIX.1-2001 Yes
ftruncate <unistd.h> Truncate a file referenced by file descriptor POSIX.1-2001 Yes

Directories

Function Header Description Standard MT-Safe
mkdir <sys/stat.h> Create a new directory POSIX.1-2001 Yes
mkdirat <sys/stat.h> Create a directory relative to a directory file descriptor POSIX.1-2008 Yes
rmdir <unistd.h> Remove a directory if it is empty POSIX.1-2001 Yes
chdir <unistd.h> Change the working directory POSIX.1-2001 Yes
fchdir <unistd.h> Change working directory via file descriptor POSIX.1-2001 Yes
getcwd <unistd.h> Get the current working directory pathname POSIX.1-2001 Yes
getwd <unistd.h> Get current working directory pathname (legacy) 4.3BSD, POSIX.1-2001 Yes
chroot <unistd.h> Change the root directory BSD, SUSv2 Yes
opendir <dirent.h> Open a directory stream POSIX.1-2001 Yes
fdopendir <dirent.h> Open a directory stream given a file descriptor POSIX.1-2008 Yes
closedir <dirent.h> Close a directory stream POSIX.1-2001 Yes
readdir <dirent.h> Read a directory entry from a directory stream POSIX.1-2001 Yes
readdir_r <dirent.h> Reentrant version of readdir POSIX.1-2001 Yes
telldir <dirent.h> Return the current location in a directory stream POSIX.1-2001 Yes
seekdir <dirent.h> Set the position of the next readdir call POSIX.1-2001 Yes
rewinddir <dirent.h> Reset directory stream position to beginning POSIX.1-2001 Yes
scandir <dirent.h> Scan a directory for matching entries BSD, POSIX.1-2008 Yes
dirfd <dirent.h> Get the file descriptor associated with a directory stream BSD, POSIX.1-2008 Yes

File Ownership & Permissions

Function Header Description Standard MT-Safe
chmod <sys/stat.h> Change file permissions POSIX.1-2001 Yes
fchmod <sys/stat.h> Change file permissions via file descriptor POSIX.1-2001 Yes
fchmodat <sys/stat.h> Change file permissions relative to directory file descriptor POSIX.1-2008 Yes
chown <unistd.h> Change file ownership POSIX.1-2001 Yes
fchown <unistd.h> Change file ownership via file descriptor POSIX.1-2001 Yes
lchown <unistd.h> Change file ownership without following symlinks POSIX.1-2001 Yes
fchownat <unistd.h> Change file ownership relative to directory file descriptor POSIX.1-2008 Yes
utime <utime.h> Change file last access and modification times POSIX.1-2001 Yes
utimes <sys/time.h> Change file timestamps with microsecond precision 4.3BSD, POSIX.1-2001 Yes
utimensat <sys/stat.h> Change file timestamps with nanosecond precision relative to directory fd POSIX.1-2008 Yes
futimens <sys/stat.h> Change file timestamps with nanosecond precision via file descriptor POSIX.1-2008 Yes

File Descriptor Operations

Function Header Description Standard MT-Safe
fcntl <fcntl.h> Manipulate a file descriptor POSIX.1-2001 Yes
dup <unistd.h> Duplicate a file descriptor POSIX.1-2001 Yes
dup2 <unistd.h> Duplicate a file descriptor to a specified number POSIX.1-2001 Yes
dup3 <unistd.h> Duplicate a file descriptor with flags Linux Yes
fsync <unistd.h> Synchronize a file's in-core state with storage POSIX.1-2001 Yes
fdatasync <unistd.h> Synchronize the in-core state of a file with storage without flushing metadata POSIX.1-2001 Yes
sync <unistd.h> Commit filesystem caches to disk POSIX.1-2001 Yes
syncfs <unistd.h> Commit filesystem caches to disk for a specific filesystem Linux Yes
flock <sys/file.h> Apply or remove an advisory lock on an open file BSD, POSIX.1-2008 Yes

Pathname Resolution

Function Header Description Standard MT-Safe
realpath <stdlib.h> Return the canonicalized absolute pathname POSIX.1-2001 Yes
basename <libgen.h> Strip directory and suffix from filenames POSIX.1-2001, GNU Yes
dirname <libgen.h> Strip last component from file name POSIX.1-2001, GNU Yes
pathconf <unistd.h> Get configuration value for a pathname POSIX.1-2001 Yes
fpathconf <unistd.h> Get configuration value for a file descriptor POSIX.1-2001 Yes

Filesystem Information

Function Header Description Standard MT-Safe
statvfs <sys/statvfs.h> Get filesystem statistics POSIX.1-2001 Yes
fstatvfs <sys/statvfs.h> Get filesystem statistics via file descriptor POSIX.1-2001 Yes
statfs <sys/vfs.h> Get filesystem statistics (Linux-specific) BSD, Linux Yes
fstatfs <sys/vfs.h> Get filesystem statistics via file descriptor (Linux-specific) BSD, Linux Yes
mount <sys/mount.h> Mount filesystem Linux, BSD Yes
umount <sys/mount.h> Unmount filesystem Linux, BSD Yes
umount2 <sys/mount.h> Unmount filesystem with flags Linux Yes


Process Control (unistd.h, sys/wait.h)

Process Creation

Function Header Description Standard MT-Safe
fork <unistd.h> Create a new process by duplicating the calling process POSIX.1-2001 Yes
vfork <sys/types.h> Create a child process and block parent POSIX.1-2001 (marked obsolete) Yes
clone <sched.h> Create a child process in a Linux-specific way Linux Yes
clone3 <sched.h> Create a child process (extended version) Linux Yes

Process Execution

Function Header Description Standard MT-Safe
execve <unistd.h> Execute program with environment POSIX.1-2001 Yes
execv <unistd.h> Execute program POSIX.1-2001 Yes
execvp <unistd.h> Execute program with PATH lookup POSIX.1-2001 Yes
execvpe <unistd.h> Execute program with PATH lookup and environment GNU Yes
execl <unistd.h> Execute program with argument list POSIX.1-2001 Yes
execlp <unistd.h> Execute program with PATH lookup and argument list POSIX.1-2001 Yes
execle <unistd.h> Execute program with argument list and environment POSIX.1-2001 Yes
system <stdlib.h> Execute a shell command POSIX.1-2001 Yes
posix_spawn <spawn.h> Spawn a process (POSIX) POSIX.1-2001 Yes
posix_spawnp <spawn.h> Spawn a process with PATH lookup (POSIX) POSIX.1-2001 Yes

Process Termination

Function Header Description Standard MT-Safe
exit <stdlib.h> Cause normal process termination POSIX.1-2001, C89 Yes
_exit <unistd.h> Terminate the calling process immediately POSIX.1-2001 Yes
_Exit <stdlib.h> Equivalent to _exit POSIX.1-2001, C99 Yes
on_exit <stdlib.h> Register a function to be called at normal process termination BSD, SVID Yes
atexit <stdlib.h> Register a function to be called at normal process termination POSIX.1-2001, C89 Yes
abort <stdlib.h> Cause abnormal process termination POSIX.1-2001, C89 Yes

Process Identification

Function Header Description Standard MT-Safe
getpid <unistd.h> Return process ID (PID) POSIX.1-2001 Yes
getppid <unistd.h> Return parent process ID POSIX.1-2001 Yes
getpgrp <unistd.h> Return the process group ID of the calling process POSIX.1-2001 Yes
setpgrp <unistd.h> Set process group ID POSIX.1-2001 Yes
getsid <unistd.h> Get session ID POSIX.1-2001 Yes
setsid <unistd.h> Create session and set process group ID POSIX.1-2001 Yes
gettid <unistd.h> Get thread identification (Linux) Linux Yes

Process Waiting

Function Header Description Standard MT-Safe
wait <sys/wait.h> Wait for process to change state POSIX.1-2001 Yes
waitpid <sys/wait.h> Wait for a specific process to change state POSIX.1-2001 Yes
wait3 <sys/wait.h> Wait for process to change state with resource usage info BSD, SVID Yes
wait4 <sys/wait.h> Wait for a specific process to change state with resource usage info BSD, SVID Yes
waitid <sys/wait.h> Wait for a child process to change state (extended) POSIX.1-2001 Yes
WIFEXITED <sys/wait.h> Test whether child process terminated normally POSIX.1-2001 Yes
WIFSIGNALED <sys/wait.h> Test whether child process was terminated by a signal POSIX.1-2001 Yes
WIFSTOPPED <sys/wait.h> Test whether child process was stopped POSIX.1-2001 Yes
WEXITSTATUS <sys/wait.h> Get the child process exit status POSIX.1-2001 Yes
WTERMSIG <sys/wait.h> Get the signal that caused the child to terminate POSIX.1-2001 Yes

Process Scheduling & Priority

Function Header Description Standard MT-Safe
nice <unistd.h> Change process priority POSIX.1-2001 Yes
getpriority <sys/resource.h> Get program scheduling priority POSIX.1-2001, BSD Yes
setpriority <sys/resource.h> Set program scheduling priority POSIX.1-2001, BSD Yes
sched_setaffinity <sched.h> Set a thread CPU affinity mask Linux Yes
sched_getaffinity <sched.h> Get a thread CPU affinity mask Linux Yes
sched_setattr <sched.h> Set scheduling policy and attributes Linux Yes
sched_getattr <sched.h> Get scheduling policy and attributes Linux Yes
sched_yield <sched.h> Yield the processor POSIX.1-2001 Yes
sched_get_priority_max <sched.h> Get maximum priority POSIX.1-2001 Yes
sched_get_priority_min <sched.h> Get minimum priority POSIX.1-2001 Yes

Resource Limits

Function Header Description Standard MT-Safe
getrlimit <sys/resource.h> Get resource limits POSIX.1-2001 Yes
setrlimit <sys/resource.h> Set resource limits POSIX.1-2001 Yes
prlimit <sys/resource.h> Get and set resource limits of an arbitrary process Linux Yes
getrusage <sys/resource.h> Get resource usage statistics POSIX.1-2001, BSD Yes
ulimit <ulimit.h> Get and set user limits POSIX.1-2001 (obsolete) Yes


Signal Handling (signal.h)

Signal Operations

Function Header Description Standard MT-Safe
signal <signal.h> Signal management (simple) POSIX.1-2001, C89 Yes
sigaction <signal.h> Signal management with extended options POSIX.1-2001 Yes
kill <signal.h> Send a signal to a process or process group POSIX.1-2001 Yes
killpg <signal.h> Send a signal to a process group BSD, POSIX.1-2001 Yes
raise <signal.h> Send a signal to the calling thread POSIX.1-2001, C89 Yes
pthread_kill <signal.h> Send a signal to a thread POSIX.1-2001 Yes
tgkill <signal.h> Send a signal to a thread in a thread group Linux Yes

Signal Sets

Function Header Description Standard MT-Safe
sigemptyset <signal.h> Initialize an empty signal set POSIX.1-2001, C89 Yes
sigfillset <signal.h> Initialize a full signal set POSIX.1-2001, C89 Yes
sigaddset <signal.h> Add a signal to a signal set POSIX.1-2001, C89 Yes
sigdelset <signal.h> Delete a signal from a signal set POSIX.1-2001, C89 Yes
sigismember <signal.h> Test for a signal in a signal set POSIX.1-2001, C89 Yes

Signal Masks & Waiting

Function Header Description Standard MT-Safe
sigprocmask <signal.h> Examine and change blocked signals POSIX.1-2001 Yes
pthread_sigmask <signal.h> Examine and change blocked signals for thread POSIX.1-2001 Yes
sigsuspend <signal.h> Wait for a signal POSIX.1-2001 Yes
sigwait <signal.h> Wait for a signal POSIX.1-2001 Yes
sigwaitinfo <signal.h> Wait for queued signals synchronously POSIX.1-2001 Yes
sigtimedwait <signal.h> Wait for queued signals with timeout POSIX.1-2001 Yes
sigpending <signal.h> Examine pending signals POSIX.1-2001 Yes
pause <unistd.h> Wait for signal POSIX.1-2001 Yes

Signal Stack

Function Header Description Standard MT-Safe
sigaltstack <signal.h> Set and/or get signal stack context POSIX.1-2001 Yes
setjmp <setjmp.h> Save stack context for non-local goto POSIX.1-2001, C89 Yes
longjmp <setjmp.h> Non-local jump to a saved stack context POSIX.1-2001, C89 Yes
sigsetjmp <setjmp.h> Save stack context and signal mask POSIX.1-2001 Yes
siglongjmp <setjmp.h> Non-local jump with signal mask restoration POSIX.1-2001 Yes

Realtime Signal Queuing

Function Header Description Standard MT-Safe
sigqueue <signal.h> Queue a signal and data to a process POSIX.1-2001 Yes


Environment & System Info (unistd.h, sys/utsname.h)

Environment Variables

Function Header Description Standard MT-Safe
getenv <stdlib.h> Get value of environment variable POSIX.1-2001, C89 Yes
setenv <stdlib.h> Change or add an environment variable POSIX.1-2001 Yes
unsetenv <stdlib.h> Remove an environment variable POSIX.1-2001 Yes
putenv <stdlib.h> Change or add an environment variable POSIX.1-2001 Yes
clearenv <stdlib.h> Clear the environment GNU Yes

User & Group Identification

Function Header Description Standard MT-Safe
getuid <unistd.h> Get user identity POSIX.1-2001 Yes
geteuid <unistd.h> Get effective user identity POSIX.1-2001 Yes
getgid <unistd.h> Get group identity POSIX.1-2001 Yes
getegid <unistd.h> Get effective group identity POSIX.1-2001 Yes
setuid <unistd.h> Set user identity POSIX.1-2001 Yes
seteuid <unistd.h> Set effective user identity POSIX.1-2001 Yes
setgid <unistd.h> Set group identity POSIX.1-2001 Yes
setegid <unistd.h> Set effective group identity POSIX.1-2001 Yes
setreuid <unistd.h> Set real and effective user IDs POSIX.1-2001 Yes
setregid <unistd.h> Set real and effective group IDs POSIX.1-2001 Yes
getgroups <unistd.h> Get list of supplementary group IDs POSIX.1-2001 Yes
setgroups <unistd.h> Set list of supplementary group IDs BSD, SVID Yes
getlogin <unistd.h> Get username POSIX.1-2001 Yes
getlogin_r <unistd.h> Get username reentrant POSIX.1-2001 Yes

System Identification

Function Header Description Standard MT-Safe
uname <sys/utsname.h> Get name and information about current kernel POSIX.1-2001 Yes
gethostname <unistd.h> Get hostname POSIX.1-2001, BSD Yes
sethostname <unistd.h> Set hostname BSD, SVID Yes
getdomainname <unistd.h> Get domain name BSD, SVID Yes
setdomainname <unistd.h> Set domain name BSD, SVID Yes
sysinfo <sys/sysinfo.h> Get overall system statistics Linux Yes

System Configuration

Function Header Description Standard MT-Safe
sysconf <unistd.h> Get configuration information at runtime POSIX.1-2001 Yes
confstr <unistd.h> Get configuration-dependent string values POSIX.1-2001 Yes
getpagesize <unistd.h> Get memory page size POSIX.1-2001 Yes
get_phys_pages <sys/sysinfo.h> Get number of physical pages GNU Yes
get_avphys_pages <sys/sysinfo.h> Get available physical pages GNU Yes

Terminal Control

Function Header Description Standard MT-Safe
isatty <unistd.h> Test whether a file descriptor refers to a terminal POSIX.1-2001 Yes
ttyname <unistd.h> Return name of a terminal POSIX.1-2001 Yes
ttyname_r <unistd.h> Return name of a terminal reentrant POSIX.1-2001 Yes
ctermid <stdio.h> Get controlling terminal name POSIX.1-2001, C89 Yes

Daemon Process

Function Header Description Standard MT-Safe
daemon <unistd.h> Run in the background as a daemon BSD, SVID Yes
setsid <unistd.h> Creates a session and sets the process group ID POSIX.1-2001 Yes


Error Handling (errno.h)

Error Reporting

Function Header Description Standard MT-Safe
strerror <string.h> Return string describing error number POSIX.1-2001, C89 Yes
strerror_r <string.h> Reentrant version of strerror POSIX.1-2001 Yes
perror <stdio.h> Print a message describing the value of errno POSIX.1-2001, C89 Yes
err <err.h> Display formatted error messages BSD Yes
errx <err.h> Display formatted error messages without errno info BSD Yes
warn <err.h> Display formatted warning messages BSD Yes
warnx <err.h> Display formatted warning messages without errno info BSD Yes
errno <errno.h> Number of last error POSIX.1-2001, C89 Yes

Program Name

Function Header Description Standard MT-Safe
program_invocation_name <errno.h> Name used to invoke the calling program GNU Yes
program_invocation_short_name <errno.h> Basename of the program invocation name GNU Yes
error <error.h> Print error message with status GNU Yes
error_at_line <error.h> Print error message with file and line GNU Yes


Locale & Internationalization (locale.h, libintl.h, iconv.h)

Locale Management

Function Header Description Standard MT-Safe
setlocale <locale.h> Set the current locale POSIX.1-2001, C89 Yes
localeconv <locale.h> Get numeric and monetary formatting information POSIX.1-2001, C89 Yes
uselocale <locale.h> Set locale for the calling thread POSIX.1-2008 Yes
newlocale <locale.h> Create a new locale object POSIX.1-2008 Yes
duplocale <locale.h> Duplicate a locale object POSIX.1-2008 Yes
freelocale <locale.h> Free a locale object POSIX.1-2008 Yes

Message Translation (gettext)

Function Header Description Standard MT-Safe
gettext <libintl.h> Translate a message using default domain POSIX.1-2001 Yes
dgettext <libintl.h> Translate a message using a given domain POSIX.1-2001 Yes
dcgettext <libintl.h> Translate a message using given domain and category POSIX.1-2001 Yes
ngettext <libintl.h> Translate message with plural forms POSIX.1-2001 Yes
dngettext <libintl.h> Translate message with plural forms in given domain POSIX.1-2001 Yes
dcngettext <libintl.h> Translate message with plural forms given domain/category POSIX.1-2001 Yes
textdomain <libintl.h> Set the default text domain POSIX.1-2001 Yes
bindtextdomain <libintl.h> Bind domain to directory POSIX.1-2001 Yes
bind_textdomain_codeset <libintl.h> Specify output codeset for message catalog GNU Yes

Character Encoding Conversion

Function Header Description Standard MT-Safe
iconv_open <iconv.h> Allocate descriptor for character set conversion POSIX.1-2001 Yes
iconv <iconv.h> Perform character set conversion POSIX.1-2001 Yes
iconv_close <iconv.h> Deallocate descriptor for character set conversion POSIX.1-2001 Yes


Regular Expressions (regex.h)

Function Header Description Standard MT-Safe
regcomp <regex.h> Compile a regular expression into an executable form POSIX.1-2001 Yes
regexec <regex.h> Execute a compiled regular expression POSIX.1-2001 Yes
regerror <regex.h> Get description of error code for regex functions POSIX.1-2001 Yes
regfree <regex.h> Free memory allocated by regcomp POSIX.1-2001 Yes


Dynamic Linking (dlfcn.h)

Function Header Description Standard MT-Safe
dlopen <dlfcn.h> Open and load a dynamic shared object POSIX.1-2001 Yes
dlclose <dlfcn.h> Close a dynamic shared object POSIX.1-2001 Yes
dlsym <dlfcn.h> Obtain address of a symbol in a shared object POSIX.1-2001 Yes
dlvsym <dlfcn.h> Get versioned symbol GNU Yes
dlerror <dlfcn.h> Get diagnostic information POSIX.1-2001 Yes
dladdr <dlfcn.h> Translate address to symbolic information SVID, BSD Yes
dladdr1 <dlfcn.h> Translate address to symbolic info with extra data GNU Yes
dl_iterate_phdr <link.h> Walk through the program headers GNU Yes
dlmopen <dlfcn.h> Open a shared object in a new namespace GNU Yes


Threading (pthread.h)

Thread Creation & Management

Function Header Description Standard MT-Safe
pthread_create <pthread.h> Create a new thread POSIX.1-2001 Yes
pthread_exit <pthread.h> Terminate the calling thread POSIX.1-2001 Yes
pthread_join <pthread.h> Join with a terminated thread POSIX.1-2001 Yes
pthread_detach <pthread.h> Detach a thread POSIX.1-2001 Yes
pthread_self <pthread.h> Obtain ID of the calling thread POSIX.1-2001 Yes
pthread_equal <pthread.h> Compare two thread IDs POSIX.1-2001 Yes
pthread_once <pthread.h> Dynamic package initialization POSIX.1-2001 Yes
pthread_cancel <pthread.h> Send a cancellation request to a thread POSIX.1-2001 Yes
pthread_setcancelstate <pthread.h> Set cancelability state POSIX.1-2001 Yes
pthread_setcanceltype <pthread.h> Set cancelability type POSIX.1-2001 Yes
pthread_testcancel <pthread.h> Request delivery of any pending cancellation POSIX.1-2001 Yes
pthread_cleanup_push <pthread.h> Push cancellation cleanup handler POSIX.1-2001 Yes
pthread_cleanup_pop <pthread.h> Pop cancellation cleanup handler POSIX.1-2001 Yes

Thread Attributes

Function Header Description Standard MT-Safe
pthread_attr_init <pthread.h> Initialize thread attributes object POSIX.1-2001 Yes
pthread_attr_destroy <pthread.h> Destroy thread attributes object POSIX.1-2001 Yes
pthread_attr_setdetachstate <pthread.h> Set detach state attribute POSIX.1-2001 Yes
pthread_attr_getdetachstate <pthread.h> Get detach state attribute POSIX.1-2001 Yes
pthread_attr_setstacksize <pthread.h> Set stack size attribute POSIX.1-2001 Yes
pthread_attr_getstacksize <pthread.h> Get stack size attribute POSIX.1-2001 Yes
pthread_attr_setstack <pthread.h> Set stack address and size attributes POSIX.1-2001 Yes
pthread_attr_getstack <pthread.h> Get stack address and size attributes POSIX.1-2001 Yes
pthread_attr_setguardsize <pthread.h> Set guard size attribute POSIX.1-2001 Yes
pthread_attr_getguardsize <pthread.h> Get guard size attribute POSIX.1-2001 Yes
pthread_attr_setscope <pthread.h> Set contention scope attribute POSIX.1-2001 Yes
pthread_attr_getscope <pthread.h> Get contention scope attribute POSIX.1-2001 Yes
pthread_attr_setschedpolicy <pthread.h> Set scheduling policy attribute POSIX.1-2001 Yes
pthread_attr_getschedpolicy <pthread.h> Get scheduling policy attribute POSIX.1-2001 Yes
pthread_attr_setschedparam <pthread.h> Set scheduling parameter attributes POSIX.1-2001 Yes
pthread_attr_getschedparam <pthread.h> Get scheduling parameter attributes POSIX.1-2001 Yes
pthread_attr_setinheritsched <pthread.h> Set inherit scheduler attribute POSIX.1-2001 Yes
pthread_attr_getinheritsched <pthread.h> Get inherit scheduler attribute POSIX.1-2001 Yes

Thread-Specific Data

Function Header Description Standard MT-Safe
pthread_key_create <pthread.h> Create a thread-specific data key POSIX.1-2001 Yes
pthread_key_delete <pthread.h> Delete a thread-specific data key POSIX.1-2001 Yes
pthread_setspecific <pthread.h> Associate a thread-specific value with a key POSIX.1-2001 Yes
pthread_getspecific <pthread.h> Obtain the thread-specific value for a key POSIX.1-2001 Yes


Synchronization Primitives

Mutexes

Function Header Description Standard MT-Safe
pthread_mutex_init <pthread.h> Initialize a mutex POSIX.1-2001 Yes
pthread_mutex_destroy <pthread.h> Destroy a mutex POSIX.1-2001 Yes
pthread_mutex_lock <pthread.h> Lock a mutex POSIX.1-2001 Yes
pthread_mutex_unlock <pthread.h> Unlock a mutex POSIX.1-2001 Yes
pthread_mutex_trylock <pthread.h> Try to lock a mutex without blocking POSIX.1-2001 Yes
pthread_mutex_timedlock <pthread.h> Lock a mutex with a timeout POSIX.1-2001 Yes
pthread_mutexattr_init <pthread.h> Initialize mutex attributes object POSIX.1-2001 Yes
pthread_mutexattr_destroy <pthread.h> Destroy mutex attributes object POSIX.1-2001 Yes
pthread_mutexattr_settype <pthread.h> Set mutex type POSIX.1-2001 Yes
pthread_mutexattr_gettype <pthread.h> Get mutex type POSIX.1-2001 Yes
pthread_mutexattr_setpshared <pthread.h> Set process-shared attribute POSIX.1-2001 Yes
pthread_mutexattr_getpshared <pthread.h> Get process-shared attribute POSIX.1-2001 Yes
pthread_mutexattr_setprotocol <pthread.h> Set protocol attribute POSIX.1-2001 Yes
pthread_mutexattr_getprotocol <pthread.h> Get protocol attribute POSIX.1-2001 Yes
pthread_mutexattr_setprioceiling <pthread.h> Set priority ceiling attribute POSIX.1-2001 Yes
pthread_mutexattr_getprioceiling <pthread.h> Get priority ceiling attribute POSIX.1-2001 Yes

Condition Variables

Function Header Description Standard MT-Safe
pthread_cond_init <pthread.h> Initialize a condition variable POSIX.1-2001 Yes
pthread_cond_destroy <pthread.h> Destroy a condition variable POSIX.1-2001 Yes
pthread_cond_signal <pthread.h> Restart one of the threads waiting on condition variable POSIX.1-2001 Yes
pthread_cond_broadcast <pthread.h> Unblock all threads currently blocked on condition variable POSIX.1-2001 Yes
pthread_cond_wait <pthread.h> Wait on a condition variable POSIX.1-2001 Yes
pthread_cond_timedwait <pthread.h> Wait on a condition variable with a timeout POSIX.1-2001 Yes
pthread_condattr_init <pthread.h> Initialize condition variable attributes object POSIX.1-2001 Yes
pthread_condattr_destroy <pthread.h> Destroy condition variable attributes object POSIX.1-2001 Yes
pthread_condattr_setpshared <pthread.h> Set process-shared attribute POSIX.1-2001 Yes
pthread_condattr_getpshared <pthread.h> Get process-shared attribute POSIX.1-2001 Yes
pthread_condattr_setclock <pthread.h> Set the clock selection attribute POSIX.1-2001 Yes
pthread_condattr_getclock <pthread.h> Get the clock selection attribute POSIX.1-2001 Yes

Semaphores

Function Header Description Standard MT-Safe
sem_init <semaphore.h> Initialize an unnamed semaphore POSIX.1-2001 Yes
sem_destroy <semaphore.h> Destroy an unnamed semaphore POSIX.1-2001 Yes
sem_wait <semaphore.h> Lock a semaphore POSIX.1-2001 Yes
sem_trywait <semaphore.h> Lock a semaphore without blocking POSIX.1-2001 Yes
sem_timedwait <semaphore.h> Lock a semaphore with a timeout POSIX.1-2001 Yes
sem_post <semaphore.h> Unlock a semaphore POSIX.1-2001 Yes
sem_getvalue <semaphore.h> Get the value of a semaphore POSIX.1-2001 Yes
sem_open <semaphore.h> Initialize and open a named semaphore POSIX.1-2001 Yes
sem_close <semaphore.h> Close a named semaphore POSIX.1-2001 Yes
sem_unlink <semaphore.h> Remove a named semaphore POSIX.1-2001 Yes

Read-Write Locks

Function Header Description Standard MT-Safe
pthread_rwlock_init <pthread.h> Initialize a read-write lock object POSIX.1-2001 Yes
pthread_rwlock_destroy <pthread.h> Destroy a read-write lock object POSIX.1-2001 Yes
pthread_rwlock_rdlock <pthread.h> Lock a read-write lock object for reading POSIX.1-2001 Yes
pthread_rwlock_tryrdlock <pthread.h> Lock a read-write lock for reading without blocking POSIX.1-2001 Yes
pthread_rwlock_timedrdlock <pthread.h> Lock a read-write lock for reading with timeout POSIX.1-2001 Yes
pthread_rwlock_wrlock <pthread.h> Lock a read-write lock object for writing POSIX.1-2001 Yes
pthread_rwlock_trywrlock <pthread.h> Lock a read-write lock for writing without blocking POSIX.1-2001 Yes
pthread_rwlock_timedwrlock <pthread.h> Lock a read-write lock for writing with timeout POSIX.1-2001 Yes
pthread_rwlock_unlock <pthread.h> Unlock a read-write lock object POSIX.1-2001 Yes
pthread_rwlockattr_init <pthread.h> Initialize the read-write lock attributes object POSIX.1-2001 Yes
pthread_rwlockattr_destroy <pthread.h> Destroy the read-write lock attributes object POSIX.1-2001 Yes

Spinlocks

Function Header Description Standard MT-Safe
pthread_spin_init <pthread.h> Initialize a spin lock object POSIX.1-2001 Yes
pthread_spin_destroy <pthread.h> Destroy a spin lock object POSIX.1-2001 Yes
pthread_spin_lock <pthread.h> Lock a spin lock object POSIX.1-2001 Yes
pthread_spin_trylock <pthread.h> Lock a spin lock object without blocking POSIX.1-2001 Yes
pthread_spin_unlock <pthread.h> Unlock a spin lock object POSIX.1-2001 Yes

Barriers

Function Header Description Standard MT-Safe
pthread_barrier_init <pthread.h> Initialize a barrier object POSIX.1-2001 Yes
pthread_barrier_destroy <pthread.h> Destroy a barrier object POSIX.1-2001 Yes
pthread_barrier_wait <pthread.h> Synchronize at a barrier POSIX.1-2001 Yes
pthread_barrierattr_init <pthread.h> Initialize barrier attributes object POSIX.1-2001 Yes
pthread_barrierattr_destroy <pthread.h> Destroy barrier attributes object POSIX.1-2001 Yes

Thread Signals

Function Header Description Standard MT-Safe
pthread_sigmask <signal.h> Examine and change blocked signals POSIX.1-2001 Yes
pthread_kill <signal.h> Send a signal to a thread POSIX.1-2001 Yes
sigwait <signal.h> Wait for a signal POSIX.1-2001 Yes


Networking & Sockets (sys/socket.h, netinet/in.h, arpa/inet.h, netdb.h)

Socket Creation & Management

Function Header Description Standard MT-Safe
socket <sys/socket.h> Create an endpoint for communication POSIX.1-2001 Yes
socketpair <sys/socket.h> Create a pair of connected sockets POSIX.1-2001 Yes
bind <sys/socket.h> Bind a name to a socket POSIX.1-2001 Yes
listen <sys/socket.h> Listen for connections on a socket POSIX.1-2001 Yes
accept <sys/socket.h> Accept a connection on a socket POSIX.1-2001 Yes
accept4 <sys/socket.h> Accept a connection with flags Linux Yes
connect <sys/socket.h> Initiate a connection on a socket POSIX.1-2001 Yes
shutdown <sys/socket.h> Shut down part of a full-duplex connection POSIX.1-2001 Yes
close <unistd.h> Close a file descriptor POSIX.1-2001 Yes
getsockname <sys/socket.h> Get socket name POSIX.1-2001 Yes
getpeername <sys/socket.h> Get name of connected peer POSIX.1-2001 Yes

Socket I/O

Function Header Description Standard MT-Safe
send <sys/socket.h> Send a message on a socket POSIX.1-2001 Yes
sendto <sys/socket.h> Send a message on a socket to a specified address POSIX.1-2001 Yes
sendmsg <sys/socket.h> Send a message on a socket with control data POSIX.1-2001 Yes
sendmmsg <sys/socket.h> Send multiple messages on a socket Linux Yes
recv <sys/socket.h> Receive a message from a socket POSIX.1-2001 Yes
recvfrom <sys/socket.h> Receive a message from a socket with source address POSIX.1-2001 Yes
recvmsg <sys/socket.h> Receive a message with ancillary data from a socket POSIX.1-2001 Yes
recvmmsg <sys/socket.h> Receive multiple messages on a socket Linux Yes

Socket Options

Function Header Description Standard MT-Safe
setsockopt <sys/socket.h> Set socket options POSIX.1-2001 Yes
getsockopt <sys/socket.h> Get socket options POSIX.1-2001 Yes
ioctl <sys/ioctl.h> Control device POSIX.1-2001 Yes
fcntl <fcntl.h> Manipulate file descriptor POSIX.1-2001 Yes

Byte Order Conversion

Function Header Description Standard MT-Safe
htons <arpa/inet.h> Convert host byte order to network byte order (short) POSIX.1-2001 Yes
htonl <arpa/inet.h> Convert host byte order to network byte order (long) POSIX.1-2001 Yes
ntohs <arpa/inet.h> Convert network byte order to host byte order (short) POSIX.1-2001 Yes
ntohl <arpa/inet.h> Convert network byte order to host byte order (long) POSIX.1-2001 Yes

IP Address Conversion

Function Header Description Standard MT-Safe
inet_addr <arpa/inet.h> Convert IPv4 address string to binary form POSIX.1-2001 Yes
inet_aton <arpa/inet.h> Convert IPv4 address string to binary form BSD, POSIX.1-2001 Yes
inet_ntoa <arpa/inet.h> Convert IPv4 binary address to dotted-decimal string POSIX.1-2001 Yes
inet_pton <arpa/inet.h> Convert IP address from presentation to network format POSIX.1-2001 Yes
inet_ntop <arpa/inet.h> Convert IP address from network to presentation format POSIX.1-2001 Yes

Name Resolution (DNS)

Function Header Description Standard MT-Safe
gethostbyname <netdb.h> Get network host entry (legacy) POSIX.1-2001 (obsolete) Yes
gethostbyaddr <netdb.h> Get network host entry by address (legacy) POSIX.1-2001 (obsolete) Yes
getaddrinfo <netdb.h> Network address and service translation POSIX.1-2001 Yes
freeaddrinfo <netdb.h> Free addrinfo structures POSIX.1-2001 Yes
gai_strerror <netdb.h> Print error messages from getaddrinfo return code POSIX.1-2001 Yes
getnameinfo <netdb.h> Address-to-name translation in protocol-independent manner POSIX.1-2001 Yes
getnetbyname <netdb.h> Get network entry by name BSD, POSIX.1-2001 (obsolete) Yes
getnetbyaddr <netdb.h> Get network entry by address BSD, POSIX.1-2001 (obsolete) Yes

Service & Protocol Database

Function Header Description Standard MT-Safe
getservbyname <netdb.h> Get service entry by name POSIX.1-2001 Yes
getservbyport <netdb.h> Get service entry by port POSIX.1-2001 Yes
getprotobyname <netdb.h> Get protocol entry by name POSIX.1-2001 Yes
getprotobynumber <netdb.h> Get protocol entry by number POSIX.1-2001 Yes
setservent <netdb.h> Rewind to start of services file POSIX.1-2001 Yes
endservent <netdb.h> Close services file POSIX.1-2001 Yes
setprotoent <netdb.h> Rewind to start of protocols file POSIX.1-2001 Yes
endprotoent <netdb.h> Close protocols file POSIX.1-2001 Yes

Multicast

Function Header Description Standard MT-Safe
if_nametoindex <net/if.h> Map network interface name to index POSIX.1-2001 Yes
if_indextoname <net/if.h> Map network interface index to name POSIX.1-2001 Yes
if_nameindex <net/if.h> Return all network interface names and indexes POSIX.1-2001 Yes
if_freenameindex <net/if.h> Free memory allocated by if_nameindex POSIX.1-2001 Yes


Wide Character & Multibyte (wchar.h, wctype.h)

Wide Character I/O

Function Header Description Standard MT-Safe
fgetwc <wchar.h> Read a wide character from a stream POSIX.1-2001, C99 Yes
getwc <wchar.h> Read a wide character from a stream POSIX.1-2001, C99 Yes
getwchar <wchar.h> Read a wide character from stdin POSIX.1-2001, C99 Yes
fputwc <wchar.h> Write a wide character to a stream POSIX.1-2001, C99 Yes
putwc <wchar.h> Write a wide character to a stream POSIX.1-2001, C99 Yes
putwchar <wchar.h> Write a wide character to stdout POSIX.1-2001, C99 Yes
ungetwc <wchar.h> Push a wide character back to an input stream POSIX.1-2001, C99 Yes
fgetws <wchar.h> Read a wide-character string from a stream POSIX.1-2001, C99 Yes
fputws <wchar.h> Write a wide-character string to a stream POSIX.1-2001, C99 Yes

Wide Character Formatted I/O

Function Header Description Standard MT-Safe
wprintf <wchar.h> Write formatted wide-character output to stdout POSIX.1-2001, C99 Yes
fwprintf <wchar.h> Write formatted wide-character output to a stream POSIX.1-2001, C99 Yes
swprintf <wchar.h> Write formatted wide-character output to a buffer POSIX.1-2001, C99 Yes
vwprintf <wchar.h> Equivalent to wprintf with variable argument list POSIX.1-2001, C99 Yes
vfwprintf <wchar.h> Equivalent to fwprintf with variable argument list POSIX.1-2001, C99 Yes
vswprintf <wchar.h> Equivalent to swprintf with variable argument list POSIX.1-2001, C99 Yes
wscanf <wchar.h> Read formatted wide-character input from stdin POSIX.1-2001, C99 Yes
fwscanf <wchar.h> Read formatted wide-character input from a stream POSIX.1-2001, C99 Yes
swscanf <wchar.h> Read formatted wide-character input from a buffer POSIX.1-2001, C99 Yes
vwscanf <wchar.h> Equivalent to wscanf with variable argument list POSIX.1-2001, C99 Yes
vfwscanf <wchar.h> Equivalent to fwscanf with variable argument list POSIX.1-2001, C99 Yes
vswscanf <wchar.h> Equivalent to swscanf with variable argument list POSIX.1-2001, C99 Yes

Wide Character String Operations

Function Header Description Standard MT-Safe
wcslen <wchar.h> Determine the length of a wide-character string POSIX.1-2001, C99 Yes
wcsnlen <wchar.h> Determine the length of a fixed-size wide-character string POSIX.1-2008 Yes
wcscpy <wchar.h> Copy a wide-character string POSIX.1-2001, C99 Yes
wcsncpy <wchar.h> Copy a fixed-size wide-character string POSIX.1-2001, C99 Yes
wcscat <wchar.h> Concatenate two wide-character strings POSIX.1-2001, C99 Yes
wcsncat <wchar.h> Concatenate two wide-character strings with size limit POSIX.1-2001, C99 Yes
wcscmp <wchar.h> Compare two wide-character strings POSIX.1-2001, C99 Yes
wcsncmp <wchar.h> Compare two fixed-size wide-character strings POSIX.1-2001, C99 Yes
wcscasecmp <wchar.h> Compare two wide-character strings ignoring case POSIX.1-2008 Yes
wcsncasecmp <wchar.h> Compare two fixed-size wide-character strings ignoring case POSIX.1-2008 Yes
wcschr <wchar.h> Search a wide character in a wide-character string POSIX.1-2001, C99 Yes
wcsrchr <wchar.h> Search a wide character in a wide-character string in reverse POSIX.1-2001, C99 Yes
wcsstr <wchar.h> Locate a substring in a wide-character string POSIX.1-2001, C99 Yes
wcspbrk <wchar.h> Search a wide-character string for any of a set of wide characters POSIX.1-2001, C99 Yes
wcscspn <wchar.h> Get span of wide characters not in reject string POSIX.1-2001, C99 Yes
wcsspn <wchar.h> Get span of wide characters in accept string POSIX.1-2001, C99 Yes
wcstok <wchar.h> Extract tokens from a wide-character string POSIX.1-2001, C99 Yes
wcsdup <wchar.h> Duplicate a wide-character string POSIX.1-2008 Yes

Wide Character Classification

Function Header Description Standard MT-Safe
iswalpha <wctype.h> Test for alphabetic wide character POSIX.1-2001, C99 Yes
iswlower <wctype.h> Test for lowercase wide character POSIX.1-2001, C99 Yes
iswupper <wctype.h> Test for uppercase wide character POSIX.1-2001, C99 Yes
iswdigit <wctype.h> Test for decimal digit wide character POSIX.1-2001, C99 Yes
iswxdigit <wctype.h> Test for hexadecimal digit wide character POSIX.1-2001, C99 Yes
iswspace <wctype.h> Test for whitespace wide character POSIX.1-2001, C99 Yes
iswpunct <wctype.h> Test for punctuation wide character POSIX.1-2001, C99 Yes
iswalnum <wctype.h> Test for alphanumeric wide character POSIX.1-2001, C99 Yes
iswprint <wctype.h> Test for printing wide character POSIX.1-2001, C99 Yes
iswgraph <wctype.h> Test for any printable wide character except space POSIX.1-2001, C99 Yes
iswcntrl <wctype.h> Test for control wide character POSIX.1-2001, C99 Yes
iswascii <wctype.h> Test for ASCII wide character BSD Yes
towlower <wctype.h> Convert wide character to lowercase POSIX.1-2001, C99 Yes
towupper <wctype.h> Convert wide character to uppercase POSIX.1-2001, C99 Yes

Multibyte Character Conversion

Function Header Description Standard MT-Safe
mblen <stdlib.h> Determine number of bytes in a multibyte character POSIX.1-2001, C89 Yes
mbtowc <stdlib.h> Convert a multibyte sequence to wide character POSIX.1-2001, C89 Yes
wctomb <stdlib.h> Convert a wide character to a multibyte sequence POSIX.1-2001, C89 Yes
mbstowcs <stdlib.h> Convert a multibyte string to a wide-character string POSIX.1-2001, C89 Yes
wcstombs <stdlib.h> Convert a wide-character string to a multibyte string POSIX.1-2001, C89 Yes
mbsrtowcs <wchar.h> Convert a multibyte string to wide-character string with restart POSIX.1-2001, C99 Yes
wcsrtombs <wchar.h> Convert a wide-character string to multibyte string with restart POSIX.1-2001, C99 Yes
mbsnrtowcs <wchar.h> Convert a multibyte string to wide-character string with size limit POSIX.1-2008 Yes
wcsnrtombs <wchar.h> Convert a wide-character string to multibyte with size limit POSIX.1-2008 Yes
mbrlen <wchar.h> Determine number of bytes in a multibyte sequence POSIX.1-2001, C99 Yes
mbrtowc <wchar.h> Convert a multibyte sequence to a wide character with restart POSIX.1-2001, C99 Yes
wcrtomb <wchar.h> Convert a wide character to a multibyte sequence with restart POSIX.1-2001, C99 Yes

Wide Character Numeric Conversion

Function Header Description Standard MT-Safe
wcstod <wchar.h> Convert wide-character string to double POSIX.1-2001, C99 Yes
wcstof <wchar.h> Convert wide-character string to float POSIX.1-2001, C99 Yes
wcstold <wchar.h> Convert wide-character string to long double POSIX.1-2001, C99 Yes
wcstol <wchar.h> Convert wide-character string to long integer POSIX.1-2001, C99 Yes
wcstoul <wchar.h> Convert wide-character string to unsigned long integer POSIX.1-2001, C99 Yes
wcstoll <wchar.h> Convert wide-character string to long long integer POSIX.1-2001, C99 Yes
wcstoull <wchar.h> Convert wide-character string to unsigned long long POSIX.1-2001, C99 Yes
wcstoimax <stdint.h> Convert wide-character string to intmax_t POSIX.1-2001, C99 Yes
wcstoumax <stdint.h> Convert wide-character string to uintmax_t POSIX.1-2001, C99 Yes

Wide Character Date & Time Formatting

Function Header Description Standard MT-Safe
wcsftime <time.h> Format date and time for the current locale using wide characters POSIX.1-2001, C99 Yes

Wide Character Memory Operations

Function Header Description Standard MT-Safe
wmemcpy <wchar.h> Copy wide-character memory area POSIX.1-2001, C99 Yes
wmemmove <wchar.h> Copy wide-character memory area with possible overlap POSIX.1-2001, C99 Yes
wmemset <wchar.h> Fill wide-character memory area with a constant wide character POSIX.1-2001, C99 Yes
wmemchr <wchar.h> Search a wide character in a wide-character array POSIX.1-2001, C99 Yes
wmemcmp <wchar.h> Compare two wide-character memory areas POSIX.1-2001, C99 Yes


Complex Math (complex.h)

Complex Arithmetic

Function Header Description Standard MT-Safe
cabs <complex.h> Absolute value of complex number POSIX.1-2001, C99 Yes
cabsf <complex.h> Absolute value of complex float POSIX.1-2001, C99 Yes
cabsl <complex.h> Absolute value of complex long double POSIX.1-2001, C99 Yes
carg <complex.h> Argument (phase angle) of complex number POSIX.1-2001, C99 Yes
cargf <complex.h> Argument of complex float POSIX.1-2001, C99 Yes
cargl <complex.h> Argument of complex long double POSIX.1-2001, C99 Yes
csqrt <complex.h> Square root of complex number POSIX.1-2001, C99 Yes
csqrtf <complex.h> Square root of complex float POSIX.1-2001, C99 Yes
csqrtl <complex.h> Square root of complex long double POSIX.1-2001, C99 Yes
cpow <complex.h> Complex power function POSIX.1-2001, C99 Yes
cpowf <complex.h> Complex power function (float) POSIX.1-2001, C99 Yes
cpowl <complex.h> Complex power function (long double) POSIX.1-2001, C99 Yes
cexp <complex.h> Complex exponential function POSIX.1-2001, C99 Yes
cexpf <complex.h> Complex exponential function (float) POSIX.1-2001, C99 Yes
cexpl <complex.h> Complex exponential function (long double) POSIX.1-2001, C99 Yes
clog <complex.h> Complex natural logarithm POSIX.1-2001, C99 Yes
clogf <complex.h> Complex natural logarithm (float) POSIX.1-2001, C99 Yes
clogl <complex.h> Complex natural logarithm (long double) POSIX.1-2001, C99 Yes

Complex Trigonometry

Function Header Description Standard MT-Safe
csin <complex.h> Complex sine function POSIX.1-2001, C99 Yes
ccos <complex.h> Complex cosine function POSIX.1-2001, C99 Yes
ctan <complex.h> Complex tangent function POSIX.1-2001, C99 Yes
casin <complex.h> Complex arc sine function POSIX.1-2001, C99 Yes
cacos <complex.h> Complex arc cosine function POSIX.1-2001, C99 Yes
catan <complex.h> Complex arc tangent function POSIX.1-2001, C99 Yes
csinh <complex.h> Complex hyperbolic sine function POSIX.1-2001, C99 Yes
ccosh <complex.h> Complex hyperbolic cosine function POSIX.1-2001, C99 Yes
ctanh <complex.h> Complex hyperbolic tangent function POSIX.1-2001, C99 Yes
casinh <complex.h> Complex arc hyperbolic sine function POSIX.1-2001, C99 Yes
cacosh <complex.h> Complex arc hyperbolic cosine function POSIX.1-2001, C99 Yes
catanh <complex.h> Complex arc hyperbolic tangent function POSIX.1-2001, C99 Yes

Complex Decomposition

Function Header Description Standard MT-Safe
creal <complex.h> Get real part of complex number POSIX.1-2001, C99 Yes
cimag <complex.h> Get imaginary part of complex number POSIX.1-2001, C99 Yes
conj <complex.h> Complex conjugate function POSIX.1-2001, C99 Yes
cproj <complex.h> Project into Riemann sphere POSIX.1-2001, C99 Yes


Searching & Sorting (stdlib.h, search.h)

Sorting

Function Header Description Standard MT-Safe
qsort <stdlib.h> Sort an array using quicksort algorithm POSIX.1-2001, C89 Yes
qsort_r <stdlib.h> Sort an array with user-supplied argument GNU Yes
heapsort <search.h> Sort an array using heapsort algorithm BSD Yes
mergesort <search.h> Sort an array using mergesort algorithm BSD Yes

Searching

Function Header Description Standard MT-Safe
bsearch <stdlib.h> Binary search a sorted array POSIX.1-2001, C89 Yes
bsearch_r <stdlib.h> Binary search a sorted array with user-supplied argument GNU Yes
lfind <search.h> Linear search an array POSIX.1-2001, SVID Yes
lsearch <search.h> Linear search an array, adding entry if not found POSIX.1-2001, SVID Yes

Hash Tables (hsearch)

Function Header Description Standard MT-Safe
hcreate <search.h> Create a hash table POSIX.1-2001 Yes
hsearch <search.h> Search hash table for an entry POSIX.1-2001 Yes
hdestroy <search.h> Destroy a hash table POSIX.1-2001 Yes
hcreate_r <search.h> Create a hash table (reentrant) GNU Yes
hsearch_r <search.h> Search hash table for an entry (reentrant) GNU Yes
hdestroy_r <search.h> Destroy a hash table (reentrant) GNU Yes

Binary Search Trees (tsearch)

Function Header Description Standard MT-Safe
tsearch <search.h> Search a binary tree POSIX.1-2001 Yes
tfind <search.h> Find entry in binary tree without adding POSIX.1-2001 Yes
tdelete <search.h> Delete an entry from binary tree POSIX.1-2001 Yes
tdestroy <search.h> Destroy entire binary tree GNU Yes
twalk <search.h> Walk a binary tree POSIX.1-2001 Yes
twalk_r <search.h> Walk a binary tree (reentrant) GNU Yes


Random Numbers (stdlib.h)

Basic Random Number Generation

Function Header Description Standard MT-Safe
rand <stdlib.h> Generate a random integer POSIX.1-2001, C89 Yes
srand <stdlib.h> Seed the random number generator POSIX.1-2001, C89 Yes
rand_r <stdlib.h> Generate a random integer (reentrant) POSIX.1-2001 Yes
random <stdlib.h> Generate a random number (linear congruential) POSIX.1-2001, BSD Yes
srandom <stdlib.h> Seed random number generator POSIX.1-2001, BSD Yes
setstate <stdlib.h> Set random number generator state array POSIX.1-2001, BSD Yes
initstate <stdlib.h> Initialize random number generator state array POSIX.1-2001, BSD Yes

Advanced Random Number Generation

Function Header Description Standard MT-Safe
drand48 <stdlib.h> Generate uniformly distributed doubles POSIX.1-2001, SVID Yes
erand48 <stdlib.h> Generate uniformly distributed doubles with seed POSIX.1-2001, SVID Yes
lrand48 <stdlib.h> Generate uniformly distributed long integers POSIX.1-2001, SVID Yes
nrand48 <stdlib.h> Generate uniformly distributed long integers with seed POSIX.1-2001, SVID Yes
mrand48 <stdlib.h> Generate signed long integers POSIX.1-2001, SVID Yes
jrand48 <stdlib.h> Generate signed long integers with seed POSIX.1-2001, SVID Yes
srand48 <stdlib.h> Seed random number generator POSIX.1-2001, SVID Yes
seed48 <stdlib.h> Seed random number generator and return previous seed POSIX.1-2001, SVID Yes
lcong48 <stdlib.h> Set random number generator parameters POSIX.1-2001, SVID Yes

Cryptographic Random Numbers

Function Header Description Standard MT-Safe
random_get_bytes <bsd/stdlib.h> Get random bytes (BSD) BSD Yes
arc4random <stdlib.h> Pseudo-random number generator BSD Yes
arc4random_buf <stdlib.h> Fill buffer with random bytes BSD Yes
arc4random_uniform <stdlib.h> Generate uniform random integer less than upper bound BSD Yes
getrandom <sys/random.h> Obtain a series of random bytes (Linux) Linux Yes


Last updated: 2024

About

A collective list of free APIs

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 96.5%
  • Shell 3.5%