Summary of Functions

This chapter includes the following:

Here are the categories:

Summary of function categories

We've organized the functions in the C library into the following categories:

Asynchronous I/O functions
Asynchronous read, write, and other I/O operations.
Atomic functions
Thread-safe integer manipulation functions.
Character manipulation functions
Single-character functions for upper/lowercase conversions.
Conversion functions
Convert values from one representation to another (e.g. numeric values to strings).
Directory functions
Directory services (change, open, close, etc.).
Dispatch interface functions
Handle different event types, including messages, pulse codes, and signals.
File manipulation functions
File operations (change permissions, delete, rename, etc.)
IPC functions
Traditional InterProcess Communication functions.
Hardware functions
These functions work with PCI and other devices.
Math functions
Perform computations such as the common trigonometric calculations. These functions operate with floating-point values.
Memory allocation functions
Allocate and deallocate memory.
Memory manipulation functions
Manipulate blocks of memory.
Message-queue functions
Nonblocking message-passing facilities.
Multibyte character functions
ANSI C functions for processing multibyte and wide characters.
QNX Neutrino-specific IPC functions
Native message-passing and related functions.
Operating system I/O functions
POSIX functions for performing I/O at a lower level than the C Language stream I/O functions (e.g. fopen(), fread(), fwrite(), and fclose() ).
PC Card functions
Native PC Card functions.
Platform-specific functions
Invoke Intel 80x86 and other processor-related functions directly from a program.
Process environment functions
For process identification, user identification, process groups, system identification, system time and process time, environment variables, terminal identification, and configurable system variables.
Process manipulation functions
For process creation, execution, and termination; signal handling; and timer operations.
Realtime timer functions
Rich set of "inexpensive" timer functions that are quick to create and manipulate.
Resource manager functions
These functions help you create resource managers.
Searching and sorting functions
Perform various search and sort operations (do a binary search on a sorted array, find one string inside another, etc.).
Shared-memory functions
Create and manipulate shared-memory regions.
Signal functions
Rich set of functions for handling and sending signals.
Stream I/O functions
The "standard" functions to read and write files. Data can be transmitted under format control or as characters, strings, or blocks of memory.
String manipulation functions
Manipulate a character string, i.e. an array of zero or more adjacent characters followed by a NUL character (\0) that marks the end of the string.
System database functions
Allow an application to access group and user database information.
System message log functions
This set of functions controls the system log.
TCP/IP functions
Handle TCP/IP network communications and the TCP/IP database files.
Terminal control functions
Set and control terminal attributes (baud rate, flow control, etc.).
Thread functions
Operate on threads and the objects used to synchronize threads.
Time functions
Obtain and manipulate times and dates.
Variable-length argument list functions
Process a variable number of arguments to a function.
Wide-character functions
Wide-character versions of functions from other function summary categories.

The following subsections describe these function categories in more detail. Each function is noted with a brief description of its purpose.

Asynchronous I/O functions

These functions perform asynchronous read, write, and other I/O operations.


Note: Asynchronous I/O operations aren't currently supported.

The following functions are defined:

aio_cancel()
Cancel an asynchronous I/O operation
aio_error()
Get the error status for an asynchronous I/O operation
aio_fsync()
Asynchronously synchronize a file
aio_read()
Asynchronously read from a file
aio_return()
Get the return status for an asynchronous I/O operation
aio_suspend()
Wait for asynchronous I/O operations to complete
aio_write()
Asynchronously write to a file

Atomic functions

These functions manipulate an integer in a thread-safe way. On a multiprocessor system, even a simple:

/*
 Assuming x is an unsigned variable shared between two 
 or more threads or a thread and an interrupt handler.
*/

x ^= 0xdeadbeef;

may cause x to be in an undefined state if multiple threads running simultaneously on multiple processors execute this code at the same time.

Use the atomic*() functions to ensure that your integer operations are carried out properly:

atomic_toggle( &x, 0xdeadbeef );
atomic_add()
Safely add to a variable
atomic_add_value()
Safely add to a variable, returning the previous value
atomic_clr()
Safely clear a variable
atomic_clr_value()
Safely clear a variable, returning the previous value
atomic_set()
Safely set bits in a variable
atomic_set_value()
Safely set bits in a variable, returning the previous value
atomic_sub()
Safely subtract from a variable
atomic_sub_value()
Safely subtract from a variable, returning the previous value
atomic_toggle()
Safely toggle a variable
atomic_toggle_value()
Safely toggle a variable, returning the previous value

Character manipulation functions

These functions operate on single characters of type char. The functions test characters in various ways and convert them between upper and lowercase. (Some of these functions have wide-character versions in the "Wide-character functions" section of the function summary.)

isalnum()
Test a character to see if it's alphanumeric
isalpha()
Test to see if a character is a letter
isascii()
Test for a character in the range 0 to 127
iscntrl()
Test a character to see if it's a control character
isdigit()
Test for any decimal digit
isgraph()
Test for any printable character except space
islower()
Test for any lowercase letter
isprint()
Test for any printable character, including space
ispunct()
Test for any punctuation character
isspace()
Test for a whitespace character
isupper()
Test for any uppercase letter
isxdigit()
Test for any hexadecimal digit
tolower()
Convert a character to lowercase
toupper()
Convert a character to uppercase

Conversion functions

These functions perform conversions between objects of various types and strings:

atof()
Convert a string into a double
atoh()
Convert a string containing a hexadecimal number into an unsigned number
atoi()
Convert a string into an integer
atol(), atoll()
Convert a string into a long integer
ENDIAN_BE16()
Return a big-endian 16-bit value in native format
ENDIAN_BE32()
Return a big-endian 32-bit value in native format
ENDIAN_BE64()
Return a big-endian 64-bit value in native format
ENDIAN_LE16()
Return a little-endian 16-bit value in native format
ENDIAN_LE32()
Return a little-endian 32-bit value in native format
ENDIAN_LE64()
Return a little-endian 64-bit value in native format
ENDIAN_RET16()
Return an endian-swapped 16-bit value
ENDIAN_RET32()
Return an endian-swapped 32-bit value
ENDIAN_RET64()
Return an endian-swapped 64-bit value
ENDIAN_SWAP16()
Endian-swap a 16-bit value in place
ENDIAN_SWAP32()
Endian-swap a 32-bit value in place
ENDIAN_SWAP64()
Endian-swap a 64-bit value in place
htonl()
Convert a 32-bit value from host-byte order to network-byte order
htons()
Convert a 16-bit value from host-byte order to network-byte order
itoa()
Convert an integer into a string, using a given base
ltoa(), lltoa()
Convert a long integer value into a string, using a given base
nsec2timespec()
Convert nanoseconds to a timespec structure
ntohl()
Convert network-byte order value
ntohs()
Convert network-byte order value
strtod()
Convert a string into a double
strtoimax(), strtoumax()
Convert a string into an integer
strtol(), strtoll()
Convert a string into a long integer
strtoul(), strtoull()
Convert a string into an unsigned long integer
timespec
Time-specification structure
timespec2nsec()
Convert a timespec structure to nanoseconds
ultoa(), ulltoa()
Convert an unsigned long integer into a string, using a given base
UNALIGNED_PUT16()
Write a misaligned 16-bit value safely
UNALIGNED_PUT32()
Write a misaligned 32-bit value safely
UNALIGNED_PUT64()
Write a misaligned 64-bit value safely
UNALIGNED_RET16()
Access a misaligned 16-bit value safely
UNALIGNED_RET32()
Access a misaligned 32-bit value safely
UNALIGNED_RET64()
Access a misaligned 64-bit value safely
utoa()
Convert an unsigned integer into a string, using a given base
wordexp()
Perform word expansions
wordfree()
Free a word expansion buffer

See also the following functions, which convert the cases of characters and strings:

Directory functions

These functions pertain to directory manipulation:

alphasort()
Compare two directory entries
chdir()
Change the current working directory
chroot()
Change the root directory
closedir()
Close a directory
dircntl()
Control an open directory
dirname()
Report the parent directory name of a file pathname
getcwd()
Get the name of the current working directory
getwd()
Get current working directory pathname
glob()
Find paths matching a pattern
globfree()
Free storage allocated by a call to glob()
mkdir()
Create a subdirectory
mount()
Mount a filesystem
mount_parse_generic_args()
Strip off common mount arguments
opendir()
Open a directory file
pathfind(), pathfind_r()
Search for a file in a list of directories
readdir()
Get information about the next matching filename
readdir_r()
Get information about the next matching filename
realpath()
Resolve a pathname
rewinddir()
Reset the position of a directory stream to the start of the directory
rmdir()
Delete an empty directory
scandir()
Scan a directory
seekdir()
Set the position for the next read of the directory stream
telldir()
Get the location associated with the directory stream
umount()
Unmount a filesystem

Dispatch interface functions

These functions make up the dispatch interface where you can handle different event types including messages, pulse codes, and signals. The functions cover dispatch contexts, attaching events, attaching pathnames and file descriptors to dispatch contexts, thread pools, etc. For an overview of these functions, see "Components of a resource manager" in the Writing a Resource Manager chapter of the QNX Neutrino Programmer's Guide.

dispatch_block()
Block while waiting for an event
dispatch_context_alloc()
Return a dispatch context
dispatch_context_free()
Free a dispatch context
dispatch_create()
Allocate a dispatch handle
dispatch_destroy()
Destroy a dispatch handle
dispatch_handler()
Handle events received by dispatch_block()
dispatch_timeout()
Set a timeout
dispatch_unblock()
Unblock all of the threads that are blocked on a dispatch handle
message_attach()
Attach a message range
message_connect()
Create a connection to a channel
message_detach()
Detach a message range
name_attach()
Register a name in the namespace and create a channel
name_detach()
Remove a name from the namespace and destroy the channel
_pulse
Structure that describes a pulse
pulse_attach()
Attach a handler function to a pulse code
pulse_detach()
Detach a handler function from a pulse code
resmgr_attach()
Attach a path to a pathname space
resmgr_block()
Block while waiting for a message
resmgr_connect_funcs_t
Table of POSIX-level connect functions
resmgr_context_alloc()
Allocate a resource-manager context
resmgr_context_free()
Free a resource-manager context
resmgr_context_t
Context information that's passed between resource-manager functions
resmgr_detach()
Remove a pathname from the pathname space
resmgr_devino()
Get the device and inode number
_resmgr_handle_grow()
Expand the capacity of the device manager database
resmgr_handle_tune()
Tune aspects of client fd-to-OCB mapping
resmgr_handler()
Handle resource manager messages
_resmgr_io_func()
Retrieve an I/O function from an I/O function table
resmgr_io_funcs_t
Table of POSIX-level I/O functions
resmgr_iofuncs()
Extract the I/O function pointers associated with client connections
resmgr_msgread()
Read a message from a client
resmgr_msgreadv()
Read a message from a client
resmgr_msgwrite()
Write a message to a client
resmgr_msgwritev()
Write a message to a client
_RESMGR_NPARTS()
Get a given number of parts from the ctp->iov structure
_resmgr_ocb()
Retrieve an Open Control Block
resmgr_open_bind()
Associate an OCB with an open request
resmgr_pathname()
Return the pathname associated with an ID
_RESMGR_PTR()
Get one part from the ctp->iov structure and fill in its fields
_RESMGR_STATUS()
Set the status member of a resource-manager context
resmgr_unbind()
Remove an OCB
select_attach()
Attach a file descriptor to a dispatch handle
select_detach()
Detach a file descriptor from a dispatch handle
select_query()
Decode the last select event
thread_pool_create()
Create a thread pool handle
thread_pool_control()
Control the thread pool behavior
thread_pool_destroy()
Free the memory allocated to a thread pool
thread_pool_limits()
Wrapper function for thread_pool_control()
thread_pool_start()
Start a thread pool

File manipulation functions

These functions operate directly with files. The following functions are defined:

access()
Check to see if a file or directory can be accessed
chmod()
Change the permissions for a file
chown()
Change the user ID and group ID of a file
eaccess()
Check to see if a file or directory can be accessed (extended version)
glob()
Find paths matching a pattern
globfree()
Free storage allocated by a call to glob()
fchmod()
Change the permissions for a file
fchown()
Change the user ID and group ID of a file
fpathconf()
Return the value of a configurable limit associated with a file or directory
ftruncate(), ftruncate64()
Truncate a file
futime()
Record the modification time for a file
lchown()
Change the user ID and group ID of a file or symbolic link
lstat(), lstat64()
Get information about a file or directory
ltrunc()
Truncate a file at a given position
mkfifo()
Create a FIFO special file
mkstemp()
Make a unique temporary filename, and open the file
mktemp()
Make a unique temporary filename
nftw(), nftw64()
Walk a file tree
pathconf()
Return the value of a configurable limit
pclose()
Close a pipe
pwrite(), pwrite64()
Write into a file without changing the file pointer
remove()
Remove a link to a file
rename()
Rename a file
stat(), stat64()
Get information about a file or directory, given a path
statvfs(), statvfs64()
Get filesystem information, given a path
sync()
Synchronize filesystem updates
tempnam()
Create a name for a temporary file
truncate()
Truncate a file to a specified length
tmpnam()
Generate a unique string for use as a filename
unlink()
Remove a link to a file
utime()
Record the modification time for a file or directory
utimes()
Set a file's access and modification times

IPC functions

These functions deal with InterProcess Communications.

flock()
Apply or remove an advisory lock on an open file
lockf()
Record locking on files
mlock()
Lock a buffer in physical memory
mlockall()
Lock a process's address space
mmap(), mmap64()
Map a memory region into a process address space
mprotect()
Change memory protection
msync()
Synchronize memory with physical storage
munlock()
Unlock a buffer
munlockall()
Unlock a process's address space
munmap()
Unmap previously mapped addresses
pthread_barrier_destroy()
Destroy a barrier object
pthread_barrier_init()
Initialize a barrier object
pthread_barrier_wait()
Synchronize at a barrier
pthread_barrierattr_destroy()
Destroy a barrier attributes object
pthread_barrierattr_getpshared()
Get the process-shared attribute of a barrier attributes object
pthread_barrierattr_init()
Initialize a barrier attributes object
pthread_barrierattr_setpshared()
Set the process-shared attribute of a barrier attributes object
pthread_cond_broadcast()
Unblock threads waiting on a condition
pthread_cond_destroy()
Destroy a condition variable
pthread_cond_init()
Initialize a condition variable
pthread_cond_signal()
Unblock the thread waiting on a condition variable
pthread_cond_timedwait()
Wait on a condition variable, with a time limit
pthread_cond_wait()
Wait on a condition variable
pthread_condattr_destroy()
Destroy a condition variable attribute object
pthread_condattr_getclock()
Get the clock attribute from a condition-variable attribute object
pthread_condattr_getpshared()
Get the process-shared attribute from a condition variable attribute object
pthread_condattr_init()
Initialize a condition variable attribute object
pthread_condattr_setclock()
Set the clock attribute in a condition-variable attribute object
pthread_condattr_setpshared()
Set the process-shared attribute in a condition-variable attribute object
pthread_mutex_destroy()
Destroy a mutex
pthread_mutex_getprioceiling()
Get a mutex's priority ceiling
pthread_mutex_init()
Initialize a mutex
pthread_mutex_lock()
Lock a mutex
pthread_mutex_setprioceiling()
Set a mutex's priority ceiling
pthread_mutex_timedlock()
Lock a mutex
pthread_mutex_trylock()
Attempt to lock a mutex
pthread_mutex_unlock()
Unlock a mutex
pthread_mutexattr_destroy()
Destroy a mutex attribute object
pthread_mutexattr_getprioceiling()
Get the priority ceiling of a mutex attribute object
pthread_mutexattr_getprotocol()
Get a mutex's scheduling protocol
pthread_mutexattr_getpshared()
Get the process-shared attribute from a mutex attribute object
pthread_mutexattr_getrecursive()
Get the recursive attribute from a mutex attribute object
pthread_mutexattr_gettype()
Get a mutex type
pthread_mutexattr_init()
Initialize the mutex attribute object
pthread_mutexattr_setprioceiling()
Set the priority ceiling of a mutex attribute object
pthread_mutexattr_setprotocol()
Set a mutex's scheduling protocol
pthread_mutexattr_setpshared()
Set the process-shared attribute in mutex attribute object
pthread_mutexattr_setrecursive()
Set the recursive attribute in mutex attribute object
pthread_mutexattr_settype()
Set a mutex type
pthread_once()
Dynamic package initialization
pthread_rwlock_destroy()
Destroy a read/write lock
pthread_rwlock_init()
Initialize a read/write lock
pthread_rwlock_rdlock()
Acquire a shared read lock on a read/write lock
pthread_rwlock_timedrdlock()
Lock a read-write lock for writing
pthread_rwlock_timedwrlock()
Attempt to acquire an exclusive write lock on a read/write lock
pthread_rwlock_tryrdlock()
Attempt to acquire a shared read lock on a read/write lock
pthread_rwlock_trywrlock()
Attempt to acquire an exclusive write lock on a read/write lock
pthread_rwlock_unlock()
Unlock a read/write lock
pthread_rwlock_wrlock()
Acquire an exclusive write lock on a read/write lock
pthread_rwlockattr_destroy()
Destroy a read-write lock attribute object
pthread_rwlockattr_getpshared()
Get the process-shared attribute of a read-write lock attribute object
pthread_rwlockattr_init()
Create a read-write lock attribute object
pthread_rwlockattr_setpshared()
Set the process-shared attribute of a read-write lock attribute object
pthread_spin_destroy()
Destroy a thread spinlock
pthread_spin_init()
Initialize a thread spinlock
pthread_spin_lock()
Lock a thread spinlock
pthread_spin_trylock()
Try locking a thread spinlock
pthread_spin_unlock()
Unlock a thread spinlock
readcond()
Read data from a terminal device
sem_close()
Close a named semaphore
sem_destroy()
Destroy a semaphore
sem_getvalue()
Get the value of a semaphore (named or unnamed)
sem_init()
Initialize a semaphore
sem_open()
Create or access a named semaphore
sem_post()
Increment a semaphore
sem_timedwait()
Wait on a semaphore, with a timeout
sem_trywait()
Wait on a semaphore, but don't block
sem_unlink()
Destroy a named semaphore
sem_wait()
Wait on a semaphore
sync()
Synchronize filesystem updates

Hardware functions

These functions work with PCI and other devices for operations such as determining whether or not a PCI BIOS is present, attaching a driver to a PCI device, and so on.

The following functions are defined:

pci_attach()
Connect to the PCI server
pci_attach_device()
Attach a driver to a PCI device
pci_detach()
Disconnect from the PCI server
pci_detach_device()
Detach a driver from a PCI device
pci_find_class()
Find devices that have a specific Class Code
pci_find_device()
Find the PCI device with a given device ID and vendor ID
pci_irq_routing_options()
Retrieve PCI IRQ routing information
pci_map_irq()
Map an interrupt pin to an IRQ
pci_present()
Determine whether or not PCI BIOS is present
pci_read_config()
Read from the configuration space of a PCI device
pci_read_config8()
Read a byte from the configuration space of a device
pci_read_config16()
Read 16-bit values from the configuration space of a device
pci_read_config32()
Read 32-bit values from the configuration space of a device
pci_rescan_bus()
Rescan the PCI bus for added or removed devices
pci_write_config()
Write to the configuration space of a PCI device
pci_write_config8()
Write bytes to the configuration space of a PCI device
pci_write_config16()
Write 16-bit values to the configuration space of a device
pci_write_config32()
Write 32-bit values to the configuration space of a device
hwi_find_item()
Find an item in the hwi_item structure
hwi_find_tag()
Find a tag in the hwi_item structure
hwi_off2tag()
Return a pointer to the start of a tag in the hwinfo area of the system page
hwi_tag2off()
Return the offset from the start of the hwinfo area of the system page

Math functions

The math functions are arranged in the following categories:

Absolute values

abs()
Return the absolute value of an integer
cabs(), cabsf()
Compute the absolute value of a complex number
fabs(), fabsf()
Compute the absolute value of a double number
labs()
Calculate the absolute value of a long integer

Bessel functions

j0(), j0f()
Compute a Bessel function of the first kind
j1(), j1f()
Compute a Bessel function of the first kind
jn(), jnf()
Compute a Bessel function of the first kind
y0(), y0f()
Compute a Bessel function of the second kind
y1(), y1f()
Compute a Bessel function of the second kind
yn(), ynf()
Compute a Bessel function of the second kind

Division, remainders, and modular arithmetic

div()
Calculate the quotient and remainder of a division operation
drem(), dremf()
Compute the remainder of two numbers
fmod(), fmodf()
Compute a residue, using floating-point modular arithmetic
ldiv()
Perform division on long integers
modf(), modff()
Break a number into integral and fractional parts
remainder(), remainderf()
Compute the floating point remainder

Floating-point settings

These functions set or get attributes of floating-point operations:

fp_exception_mask()
Get or set the current exception mask
fp_exception_value()
Get the value of the current exception registers
fp_precision()
Set or get the current precision
fp_rounding()
Set or get the current rounding

Gamma functions

gamma(), gamma_r(), gammaf(), gammaf_r()
Log gamma function
lgamma(), lgamma_r(), lgammaf(), lgammaf_r()
Log gamma function

Logarithms and exponentials

The following routines calculate logarithms and exponentials:

exp(), expf()
Compute the exponential function of a number
expm1(), expm1f()
Compute the exponential of a number, then subtract 1
frexp(), frexpf()
Break a floating-point number into a normalized fraction and an integral power of 2
ilogb(), ilogbf()
Compute the integral part of a logarithm
ldexp(), ldexpf()
Multiply a floating-point number by an integral power of 2
log(), logf()
Compute the natural logarithm of a number
log10(), log10f()
Compute the logarithm (base 10) of a number
log1p(), log1pf()
Compute log(1+x)
logb(), logbf()
Compute the radix-independent exponent
scalb(), scalbf()
Load the exponent of a radix-independent floating-point number
scalbn(), scalbnf()
Compute the exponent of a radix-independent floating-point number
significand(), significandf()
Compute the "significant bits" of a floating-point number

Miscellaneous

copysign(), copysignf()
Copy the sign bit from one number to another
erf(), erff()
Compute the error function of a number
erfc(), erfcf()
Complementary error function
finite(), finitef()
Determine if a number is finite
hypot(), hypotf()
Calculate the length of the hypotenuse for a right-angled triangle
isinf(), isinff()
Test for infinity
isnan(), isnanf()
Test for not-a-number (NAN)
max()
Return the greater of two numbers
min()
Return the lesser of two numbers
nextafter(), nextafterf()
Compute the next representable double-precision floating-point number

Pseudo-random numbers

The math library includes several sets of functions that you can use to generate pseudo-random numbers.

The simplest family consists of:

rand()
Compute a sequence of pseudo-random integers
rand_r()
Compute a sequence of pseudo-random integers in a thread-safe manner
srand()
Start a new sequence of pseudo-random integers for rand()

This set of functions uses a nonlinear additive feedback random-number generator, using a state array:

initstate()
Initialize a pseudo-random number generator
random()
Generate a pseudo-random number from the default state
setstate()
Reset the state of a pseudo-random number generator
srandom()
Set the seed for a pseudo-random number generator

This set of functions uses 48-bit arithmetic to produce pseudo-random numbers of various types:

drand48()
Generate a pseudo-random double
erand48()
Generate a pseudo-random double in a thread-safe manner
jrand48()
Generate a pseudo-random signed long integer in a thread-safe manner
lcong48()
Initialize a sequence of pseudo-random numbers
lrand48()
Generate a pseudo-random nonnegative long integer
mrand48()
Generate a pseudo-random signed long integer
nrand48()
Generate a pseudo-random nonnegative long integer in a thread-safe manner
seed48()
Initialize a sequence of pseudo-random numbers
srand48()
Initialize a sequence of pseudo-random numbers

Roots and powers

cbrt(), cbrtf()
Compute the cube root of a number
pow(), powf()
Raise a number to a given power
sqrt(), sqrtf()
Calculate the nonnegative square root of a number

Rounding

ceil(), ceilf()
Round up a value to the next integer
floor(), floorf()
Round down a value to the next integer
rint(), rintf()
Round to the nearest integral value

Trigonometric and hyperbolic functions

acos(), acosf()
Compute the arccosine of an angle
acosh(), acoshf()
Compute the inverse hyperbolic cosine
asin(), asinf()
Compute the arcsine of an angle
asinh(), asinhf()
Compute the inverse hyperbolic sine
atan(), atanf()
Compute the arctangent of an angle
atanh(), atanhf()
Compute the inverse hyperbolic tangent
atan2(), atan2f()
Compute the arctangent, determining the quadrant
cos(), cosf()
Compute the cosine of an angle
cosh(), coshf()
Compute the hyperbolic cosine
sin(), sinf()
Calculate the sine of an angle
sinh(), sinhf()
Compute the hyperbolic sine
tan(), tanf()
Calculate the tangent of an angle
tanh(), tanhf()
Calculate the hyperbolic tangent

Memory allocation functions

These functions allocate and deallocate blocks of memory:

alloca()
Allocate automatic space from the stack
_amblksiz
The increment for the break pointer
_btext
The beginning of the text segment
calloc()
Allocate space for an array
cfree()
Free allocated memory
_edata
The end of the data segment, excluding BSS data
_end
The end of the data segment, including BSS data
_etext
The end of the text segment
free()
Deallocate a block of memory
ftw()
Walk a file tree
longjmp()
Restore the environment saved by setjmp()
mallinfo()
Get memory allocation information
malloc()
Allocate memory
mallopt()
Control the memory allocation
mcheck()
Enable memory allocation routine consistency checks
memalign()
Allocate aligned memory
mprobe()
Perform consistency check on memory
posix_memalign()
Allocate aligned memory
realloc()
Allocate, reallocate or free a block of memory
sbrk()
Set the allocation break value for a program
_scalloc()
Allocate space for an array
setjmp()
Save the calling environment, for use by longjmp()
siglongjmp()
Restore the signal mask for a process, if one was saved
sigsetjmp()
Save the environment, including the signal mask
_sfree()
Deallocate a block of memory
_smalloc()
Allocate memory in blocks
_srealloc()
Allocate, reallocate or free a block of memory
valloc()
Allocate a heap block aligned on a page boundary

Memory manipulation functions

These functions manipulate blocks of memory. In each case, the address of the memory block and its size is passed to the function.(Some of these functions have wide-character versions in the "Wide-character functions" section of the function summary.)

brk()
Change the amount of space allocated for the calling process's data segment
bzero()
Set the first part of an object to null bytes
ffs()
Find the first bit set in a bit string
index()
Find a character in a string
memccpy()
Copy bytes until a given character is found
memchr()
Find the first occurrence of a character in a buffer
memcmp()
Compare a given number of characters in two objects
memcpy()
Copy a number of characters from one buffer to another
memcpyv()
Copy a given number of structures
memicmp()
Compare a given number of characters of two objects, without case sensitivity
mem_offset(), mem_offset64()
Find offset of a mapped typed memory block
memmove()
Copy bytes from one buffer to another, handling overlapping memory correctly
memset()
Set the first part of an object to a given value
mlock()
Lock a buffer in physical memory
mlockall()
Lock a process's address space
mmap(), mmap64()
Map a memory region into a process address space
mmap_device_io()
Gain access to a device's registers
mmap_device_memory()
Map a device's physical memory into a process's address space
msync()
Synchronize memory with physical storage
munlock()
Unlock a buffer
munlockall()
Unlock a process's address space
munmap_device_io()
Free access to a device's registers
munmap_device_memory()
Unmap previously mapped addresses
posix_mem_offset(), posix_mem_offset64()
Find offset and length of a mapped typed memory block
rindex()
Find the last occurrence of a character in a string
shm_ctl()
Give special attributes to a shared memory object
shm_ctl_special()
Give special attributes to a shared memory object
swab()
Endian-swap a given number of bytes

See the section "String manipulation functions" for descriptions of functions that manipulate strings of data.

Message-queue functions

These functions deal with message queues:

mq_close()
Close a message queue
mq_getattr()
Get a message queue's attributes
mq_notify()
Ask to be notified when there's a message in the queue
mq_open()
Open a message queue
mq_receive()
Receive a message from a queue
mq_send()
Send a message to a queue
mq_setattr()
Set a message queue's attributes
mq_timedreceive()
Receive a message from a message queue
mq_timedsend()
Send a message to a message queue
mq_unlink()
Remove a message queue

Multibyte character functions

These ANSI C functions provide capabilities for processing multibyte characters. (Some of these functions have wide-character versions in the "Wide-character functions" section of the function summary.)

mblen()
Count the bytes in a multibyte character
mbrlen()
Count the bytes in a multibyte character (restartable)
mbrtowc()
Convert a multibyte character into a wide character (restartable)
mbsinit()
Determine the status of the conversion object used for restartable mb*() functions
mbsrtowcs()
Convert a multibyte-character string into a wide-character string (restartable)
mbstowcs()
Convert a multibyte-character string into a wide-character string
mbtowc()
Convert a multibyte character into a wide character

QNX Neutrino-specific IPC functions

The following functions are defined:

ChannelCreate(), ChannelCreate_r()
Create a communications channel
ChannelDestroy(), ChannelDestroy_r()
Destroy a communications channel
_msg_info
Information about a message
MsgDeliverEvent(), MsgDeliverEvent_r()
Deliver an event through a channel
MsgError(), MsgError_r()
Unblock a client and set its errno
MsgInfo(), MsgInfo_r()
Get additional information about a message
MsgKeyData(), MsgKeyData_r()
Pass data through a common client
MsgRead(), MsgRead_r()
Read data from a message
MsgReadv(), MsgReadv_r()
Read data from a message
MsgReceive(), MsgReceive_r()
Wait for a message or pulse on a channel
MsgReceivePulse(), MsgReceivePulse_r()
Receive a pulse on a channel
MsgReceivePulsev(), MsgReceivePulsev_r()
Receive a pulse on a channel
MsgReceivev(), MsgReceivev_r()
Wait for a message or pulse on a channel
MsgReply(), MsgReply_r()
Reply with a message
MsgReplyv(), MsgReplyv_r()
Reply with a message
MsgSend(), MsgSend_r()
Send a message to a channel
MsgSendnc(), MsgSendnc_r()
Send a message to a channel (non-cancellation point)
MsgSendPulse(), MsgSendPulse_r()
Send a pulse to a channel
MsgSendsv(), MsgSendsv_r()
Send a message to a channel
MsgSendsvnc(), MsgSendsvnc_r()
Send a message to a channel (non-cancellation point)
MsgSendv(), MsgSendv_r()
Send a message to a channel
MsgSendvnc(), MsgSendvnc_r()
Send a message to a channel (non-cancellation point)
MsgSendvs(), MsgSendvs_r()
Send a message to a channel
MsgSendvsnc(), MsgSendvsnc_r()
Send a message to a channel (non-cancellation point)
MsgVerifyEvent(), MsgVerifyEvent_r()
Check the validity of a receive ID and an event configuration
MsgWrite(), MsgWrite_r()
Write a reply
MsgWritev(), MsgWritev_r()
Write a reply
name_close()
Close the file descriptor returned by name_open()
name_open()
Open a name for a server connection
sigevent
Structure that describes an event
SyncTypeCreate(), SyncTypeCreate_r()
Create a synchronization object

Operating system I/O functions

These functions operate at the operating-system level, and are included for compatibility with other C implementations. For new programs, we recommended that you use the functions in the section "File manipulation functions", functions are defined portably and are part of the ANSI standard for the C language.

The functions in this section reference opened files and devices using a file descriptor that's returned when the file is opened. The file descriptor is passed to the other functions.

The following functions are defined:

chsize()
Change the size of a file
cfgopen()
Open a configuration file
close()
Close a file at the operating system level
_cmdfd()
Return a file descriptor for the executable file
_cmdname()
Find the path used to invoke the current process
creat(), creat64()
Create and open a file at the operating system level
devctl()
Control a device
dup()
Duplicate a file descriptor
dup2()
Duplicate a file descriptor, specifying the new descriptor
eof()
Determine if the end-of-file has been reached
fcfgopen()
Open a configuration file
fcntl()
Provide control over an open file
fdatasync()
Write queued file data to disk
fileno()
Return the number of the file descriptor for a stream
flink()
Assign a pathname to a file descriptor
flockfile()
Acquire ownership of a file
fstat(), fstat64()
Obtain information about an open file, given a file descriptor
fstatvfs(), fstatvfs64()
Get filesystem information, given a file descriptor
fsync()
Write queued file and filesystem data to disk
ftrylockfile()
Acquire ownership of a file, without blocking
funlockfile()
Release ownership of a file
GETIOVBASE()
Get the base member of an iov_t structure
GETIOVLEN()
Get the length member of an iov_t structure
getdtablesize()
Get the size of the file descriptor table
getrusage()
Get information about resource utilization
in8()
Read an 8-bit value from a port
in8s()
Read 8-bit values from a port
in16(), inbe16(), inle16()
Read a 16-bit value from a port
in16s()
Read 16-bit values from a port
in32(), inbe32(), inle32()
Read a 32-bit value from a port
in32s()
Read 32-bit values from a port
ioctl()
Control device
link()
Create a link to an existing file
lseek(), lseek64()
Set the current file position at the OS level
lio_listio()
Initiate a list of I/O requests
mknod()
Make a new filesystem entry point
modem_open()
Open a serial port
modem_read()
Read bytes from a file descriptor
modem_script()
Run a script on a device
modem_write()
Write a string to a device
name_close()
Close the file descriptor obtained with name_open()
name_open()
Open a name for a server connection
open(), open64()
Open a file
openfd()
Open for private access a file associated with a given descriptor
out8()
Write an 8-bit value to a port
out8s()
Write 8-bit values to a port
out16(), outbe16(), outle16()
Write a 16-bit value to a port
out16s()
Write 16-bit values to a port
out32(), outbe32(), outle32()
Write a 32-bit value to a port
out32s()
Write 32-bit values to a port
pathmgr_symlink()
Create a symlink in the process manager
pathmgr_unlink()
Remove the link created by pathmgr_symlink()
pipe()
Create a pipe
poll()
Multiplex input/output over a set of file descriptors
popen()
Execute a command, creating a pipe to it
pread(), pread64()
Read from a file without moving the file pointer
rdchk()
Check to see if a read is likely to succeed
read()
Read bytes from a file
readblock()
Read blocks of data from a file
readcond()
Read data from a terminal device
readlink()
Place the contents of a symbolic link into a buffer
readv()
Read bytes from a file
select()
Check for files that are ready for reading or writing
SETIOV()
Fill in the fields of an iov_t structure
sopen()
Open a file for shared access
sopenfd()
Open for shared access a file associated with a given descriptor
symlink()
Create a symbolic link to a path
tcischars()
Determine the number of characters waiting to be read
tell(), tell64()
Determine the current file position
umask()
Set the file mode creation mask for the process
uname()
Get information about the operating system
unlink()
Delete a file
write()
Write bytes to a file
writeblock()
Write blocks of data to a file
writev()
Write bytes to a file

PC Card functions

The following functions are defined:

pccard_arm()
Arm the devp-pccard server
pccard_attach()
Attach to the devp-pccard server
pccard_detach()
Detach from the devp-pccard server
pccard_info()
Obtain socket information from the devp-pccard server
pccard_lock()
Lock the window of the card in the selected socket
pccard_raw_read()
Read the raw CIS data from the PC Card
pccard_unlock()
Unlock the window of the card in the selected socket

Platform-specific functions

These functions are for invoking Intel 80x86 and other processor-related functions directly from a program. Functions that apply to the Intel 8086 CPU apply to that family including the 80286, 80386, 80486 and Pentium processors.

You'll also find endian-related functions listed here.

The following functions are defined:

ENDIAN_BE16()
Return a big-endian 16-bit value in native format
ENDIAN_BE32()
Return a big-endian 32-bit value in native format
ENDIAN_BE64()
Return a big-endian 64-bit value in native format
ENDIAN_LE16()
Return a little-endian 16-bit value in native format
ENDIAN_LE32()
Return a little-endian 32-bit value in native format
ENDIAN_LE64()
Return a little-endian 64-bit value in native format
ENDIAN_RET16()
Return an endian-swapped 16-bit value
ENDIAN_RET32()
Return an endian-swapped 32-bit value
ENDIAN_RET64()
Return an endian-swapped 64-bit value
ENDIAN_SWAP16()
Endian-swap a 16-bit value in place
ENDIAN_SWAP32()
Endian-swap a 32-bit value in place
ENDIAN_SWAP64()
Endian-swap a 64-bit value in place
_intr_v86()
Execute a real-mode software interrupt
offsetof()
Return the offset of an element within a structure
sysmgr_reboot()
Reboot a QNX Neutrino system

Process environment functions

These functions deal with process identification, user identification, process groups, system identification, system time and process time, environment variables, terminal identification, and configurable system variables:

_argc
The number of arguments passed to main()
_argv
A pointer to the vector of arguments passed to main()
_auxv
A pointer to a vector of auxiliary arguments to main()
clearenv()
Clear the process environment area
confstr()
Get configuration-defined string values
ctermid()
Generate the pathname of the current controlling terminal
endutent()
Close the current user-information file
environ
Pointer to the process's environment variables
err(), errx()
Display a formatted error message, and then exit
errno
Global error variable
getegid()
Get the effective group ID
getenv()
Get the value of an environment variable
geteuid()
Get the effective user ID
getgid()
Get the group ID
getgrouplist()
Determine the group access list for a user
getgroups()
Get the supplementary group IDs of the calling process
getlogin()
Get the user name associated with the calling process
getlogin_r()
Get the user name associated with the calling process
getopt()
Parse options from a command line
getpgid()
Get a process's group ID
getpgrp()
Get the process group
getpid()
Get the process ID
getppid()
Get the parent process ID
getsid()
Get the session ID of a process
getuid()
Get the user ID
getutent()
Read the next entry from the user-information file
getutid()
Search for an entry in the user-information file
getutline()
Get an entry from the user-information file
initgroups()
Initialize the supplementary group access list
isatty()
Test to see if a file descriptor is associated with a terminal
login_tty()
Prepare for a login in a tty
main()
The function where program execution begins
ND_NODE_CMP()
Compare two node descriptor IDs
netmgr_ndtostr()
Convert a node descriptor into a string
netmgr_remote_nd()
Get a node descriptor that's relative to a remote node
netmgr_strtond()
Convert a string into a node descriptor
__progname
The basename of the program being executed
putenv()
Add, change, or delete an environment variable
pututline()
Write an entry in the user-information file
searchenv()
Search the directories listed in an environment variable
setegid()
Set the effective group ID for a process
setenv()
Set one or more environment variables
seteuid()
Set the effective user ID
setgid()
Set the real, effective and saved group IDs
setgroups()
Set supplementary group IDs
setlocale()
Set a program's locale.
setpgid()
Join or create a process group
setpgrp()
Set the process group
setregid()
Set real and effective group IDs
setreuid()
Set real and effect user IDs
setsid()
Create a new session
setuid()
Set the real, effective and saved user IDs
setutent()
Return to the beginning of the user-information file
strerror()
Convert an error number into an error message
sysconf()
Return the value of a configurable system limit
ttyname()
Get a fully qualified pathname for a file
ttyname_r()
Get a fully qualified pathname for a file
unsetenv()
Remove an environment variable
utmp
Entry in a user-information file
utmpname()
Change the name of the user-information file
verr(), verrx()
Display a formatted error message, and then exit (varargs)
vwarn(), vwarnx()
Formatted error message (varargs)
warn(), warnx()
Formatted error message

Process manipulation functions

These functions deal with: process creation, execution, and termination; signal handling; and timer operations.

When you start a new process, it replaces the existing process if:

The existing process may be suspended while the new process executes (control continues at the point following the place where the new process was started) in the following situations:

The following functions are defined:

abort()
Raise the SIGABRT signal to terminate program execution
alarm()
Schedule an alarm
assert()
Print a diagnostic message and optionally terminate the program
atexit()
Register functions to be called when the program terminates normally
ConnectAttach(), ConnectAttach_r()
Establish a connection between a process and a channel
ConnectClientInfo(), ConnectClientInfo_r()
Store information about a client connection
ConnectDetach(), ConnectDetach_r()
Break a connection between a process and a channel
ConnectFlags(), ConnectFlags_r()
Modify the flags associated with a connection
ConnectServerInfo(), ConnectServerInfo_r()
Store information about a connection
daemon()
Run a program in the background
DebugBreak()
Enter the process debugger
DebugKDBreak()
Enter the kernel debugger
DebugKDOutput()
Print text with the kernel debugger
delay()
Suspend a process for a given length of time
dladdr()
Translate an address to symbolic information
dlclose()
Close a shared object
dlerror()
Get dynamic loading diagnostic information
dlopen()
Gain access to an executable object file
dlsym()
Get the address of a symbol in a shared object
execl()
Execute a file
execle()
Execute a file
execlp()
Execute a file
execlpe()
Execute a file
execv()
Execute a file
execve()
Execute a file
execvp()
Execute a file
execvpe()
Execute a file
_exit()
Terminate the program
exit()
Terminate the program
fork()
Create a new process
forkpty()
Create a new process operating in a pseudo-tty
getrlimit(), getrlimit64()
Get the limit on a system resource
getprio()
Get the priority of a given process
InterruptAttach(), InterruptAttach_r()
Attach an interrupt handler to an interrupt source
InterruptAttachEvent(), InterruptAttachEvent_r()
Attach an event to an interrupt source
InterruptDetach(), InterruptDetach_r()
Detach an interrupt handler by ID
InterruptDisable()
Disable hardware interrupts
InterruptEnable()
Enable hardware interrupts
InterruptHookIdle()
Attach an "idle" interrupt handler
InterruptHookTrace()
Attach the pseudo interrupt handler that the instrumented module uses
InterruptLock()
Protect critical sections of an interrupt handler
InterruptMask()
Disable a hardware interrupt
InterruptUnlock()
Release a critical section locked with InterruptLock()
InterruptUnmask()
Enable a hardware interrupt
InterruptWait(), InterruptWait_r()
Wait for a hardware interrupt
_intr_v86()
Execute a real-mode software interrupt
kill()
Send a signal to a process or a group of processes
killpg()
Send a signal to a process group
nap()
Sleep for a given number of milliseconds
napms()
Sleep for a given number of milliseconds
nice()
Change the priority of a process
openpty()
Find an available pseudo-tty
procmgr_daemon()
Run a process in the background
procmgr_event_notify()
Ask to be notified of system-wide events
procmgr_event_trigger()
Trigger a global system event
procmgr_guardian()
Let a daemon process takeover as parent = guardian
procmgr_session()
Provide process manager session support
raise()
Signal an exceptional condition
SchedCtl()
Control the adaptive partitioning scheduler
SchedGet(), SchedGet_r()
Get the scheduling policy for a thread
SchedInfo(), SchedInfo_r()
Get scheduler information
SchedSet(), SchedSet_r()
Set the scheduling policy for a thread
SchedYield(), SchedYield_r()
Yield to other threads
setitimer()
Set the value of an interval timer
setprio()
Set the priority of a process
setrlimit(), setrlimit64()
Set the limit on a system resource
sigaction()
Examine or specify the action associated with a signal
sigaddset()
Add a signal to a set
sigblock()
Add to the mask of signals to block
sigdelset()
Delete a signal from a set
sigemptyset()
Initialize a set to contain no signals
sigfillset()
Initialize a set to contain all signals
sigismember()
See if a given signal is in a given set
sigmask()
Construct a mask for a signal number
signal()
Set handling for exceptional conditions
SignalAction(), SignalAction_r()
Examine and/or specify actions for signals
SignalKill(), SignalKill_r()
Send a signal to a process group, process or thread
SignalProcmask(), SignalProcmask_r()
Modify or examine the signal blocked mask of a thread
SignalSuspend(), SignalSuspend_r()
Suspend a process until a signal is received
SignalWaitinfo(), SignalWaitinfo_r()
Select a pending signal
sigpause()
Wait for a signal
sigpending()
Examine the set of pending, masked signals for a process
sigprocmask()
Examine or change the signal mask for a process
sigqueue()
Queue a signal to a process
sigsetmask()
Set the mask of signals to block
sigsuspend()
Replace the signal mask, and then suspend the process
sigtimedwait()
Wait for a signal or a timeout
sigunblock()
Unblock signals
sigwait()
Wait for a pending signal
sigwaitinfo()
Wait for a pending signal and get its information
sleep()
Suspend a process for a given length of time
spawn()
Create and execute a new child process
spawnl()
Create and execute a new child process
spawnle()
Create and execute a new child process
spawnlp()
Create and execute a new child process
spawnlpe()
Create and execute a new child process
spawnp()
Create and execute a new child process
spawnv()
Create and execute a new child process
spawnve()
Create and execute a new child process
spawnvp()
Create and execute a new child process
spawnvpe()
Create and execute a new child process
SyncCondvarSignal(), SyncCondvarSignal_r()
Wake up any threads that are blocked on a synchronization object
SyncCondvarWait(), SyncCondvarWait_r()
Block a thread on a synchronization object
SyncCtl(), SyncCtl_r()
Perform an operation on a synchronization object
SyncDestroy(), SyncDestroy_r()
Destroy a synchronization object
SyncMutexEvent(), SyncMutexEvent_r()
Attach an event to a mutex
SyncMutexLock(), SyncMutexLock_r()
Lock a mutex synchronization object
SyncMutexUnlock(), SyncMutexUnlock_r()
Unlock a mutex synchronization object
SyncMutexRevive(), SyncMutexRevive_r()
Revive a mutex that's in the DEAD state
SyncSemPost(), SyncSemPost_r()
Increment a semaphore
SyncSemWait(), SyncSemWait_r()
Wait on a semaphore
system()
Execute a system command
SYSPAGE_CPU_ENTRY()
Return a CPU-specific entry from the system page
SYSPAGE_ENTRY()
Return an entry from the system page
_syspage_ptr
A pointer to the system page
ThreadCancel(), ThreadCancel_r()
Cancel a thread
ThreadCreate(), ThreadCreate_r()
Create a new thread
ThreadCtl(), ThreadCtl_r()
Control a thread
ThreadDestroy(), ThreadDestroy_r()
Destroy a thread immediately
ThreadDetach(), ThreadDetach_r()
Detach a thread from a process
ThreadJoin(), ThreadJoin_r()
Block until a thread terminates
TraceEvent()
Trace kernel events
ualarm()
Schedule an alarm
usleep()
Suspend a thread for a given number of microseconds
vfork()
Spawn a new process and block the parent
wait()
Wait for the status of a terminated child process
wait3()
Wait for a child process to change state
wait4()
Wait for a child process to terminate or stop
waitid()
Wait for a child process to change state
waitpid()
Suspend the calling process

There are eight spawn*() and exec*() functions each. The * is one to three letters, where:

Realtime timer functions

These functions provide realtime timer capabilities:

clock_getres()
Get the resolution of the clock
clock_gettime()
Get the current time of a clock
clock_nanosleep()
High resolution sleep with specifiable clock
clock_settime()
Set a clock
getitimer()
Get the value of an interval timer
nanosleep()
Suspend process until a timeout or signal occurs
nanospin()
Busy-wait without thread blocking for a period of time
nanospin_calibrate()
Calibrate before calling nanospin*()
nanospin_count()
Busy-wait without blocking for a number of iterations
nanospin_ns()
Busy-wait without blocking for a period of time
nanospin_ns_to_count()
Convert a time in nanoseconds into a number of iterations
sched_getparam()
Get the current priority of a process
sched_get_priority_adjust()
Calculate the allowable priority for the scheduling policy
sched_get_priority_max()
Get the maximum value for the scheduling policy
sched_get_priority_min()
Get the minimum value for the scheduling policy
sched_getscheduler()
Get the current scheduling policy for a process
sched_param
Structure that describes scheduling parameters
sched_rr_get_interval()
Get the execution time limit of a process
sched_setparam()
Change the priority of a process
sched_setscheduler()
Change the priority and scheduling policy of a process
sched_yield()
Yield to other READY processes at the same priority
timer_create()
Create a timer
timer_delete()
Delete a timer
timer_getexpstatus()
Get the expiry status of a timer
timer_getoverrun()
Return the number of timer overruns
timer_gettime()
Get the amount of time left on a timer
timer_settime()
Set the expiration time for a timer

Resource manager functions

These functions help you create resource managers. For an overview of these functions, see "Components of a resource manager" in the Writing a Resource Manager chapter of the QNX Neutrino Programmer's Guide.

_io_connect
Structure of a resource manager's connect message
_io_connect_ftype_reply
Structure of a connect message giving a status and a file type
_io_connect_link_reply
Structure of a connect message that redirects a client to another resource
iofdinfo()
Retrieve server attributes
iofunc_attr_init()
Initialize the default attribute structure
iofunc_attr_lock()
Lock the attribute structure
iofunc_attr_t
Attribute structure
iofunc_attr_trylock()
Try to lock the attribute structure
iofunc_attr_unlock()
Unlock the attribute structure
iofunc_check_access()
Check access permissions
iofunc_chmod()
Handle an _IO_CHMOD message
iofunc_chmod_default()
Default handler for _IO_CHMOD messages
iofunc_chown()
Handle an _IO_CHOWN message
iofunc_chown_default()
Default handler for _IO_CHOWN messages
iofunc_client_info()
Return information about a client connection
iofunc_close_dup()
Frees all locks allocated for the client process
iofunc_close_dup_default()
Default handler for _IO_CLOSE messages
iofunc_close_ocb()
Return the memory allocated for an OCB
iofunc_close_ocb_default()
Return the memory allocated for an OCB
iofunc_devctl()
Handle an _IO_DEVCTL message
iofunc_devctl_default()
Default handler for _IO_DEVCTL messages
iofunc_fdinfo()
Handle an _IO_FDINFO message
iofunc_fdinfo_default()
Default handler for _IO_FDINFO messages
iofunc_func_init()
Initialize the default POSIX-layer function tables
iofunc_link()
Link two directories
iofunc_lock()
Lock a resource
iofunc_lock_calloc()
Allocate memory to lock structures
iofunc_lock_default()
Default handler for _IO_LOCK messages
iofunc_lock_free()
Return memory allocated for lock structures
iofunc_lock_ocb_default()
Default handler for the lock_ocb callout
iofunc_lseek()
Handle an _IO_LSEEK message
iofunc_lseek_default()
Default handler for _IO_LSEEK message
iofunc_mknod()
Verify a client's ability to make a new filesystem entry point
iofunc_mmap()
Handle an IO_MMAP message
iofunc_mmap_default()
Default handler for IO_MMAP messages
iofunc_notify()
Install, poll, or remove a notification handler
iofunc_notify_remove()
Remove notification entries from list
iofunc_notify_trigger()
Send notifications to queued clients
iofunc_ocb_attach()
Initialize an Open Control Block
iofunc_ocb_calloc()
Allocate an iofunc OCB
iofunc_ocb_detach()
Release OCB resources
iofunc_ocb_free()
Deallocate an iofunc OCBs memory
iofunc_ocb_t
Open Control Block structure
iofunc_open()
Verify a client's ability to open a resource
iofunc_open_default()
Default handler for _IO_CONNECT messages
iofunc_openfd()
Increment count and locking flags
iofunc_openfd_default()
Default handler for _IO_OPENFD messages
iofunc_pathconf()
Support pathconf() requests
iofunc_pathconf_default()
Default handler for _IO_PATHCONF messages
iofunc_read_default()
Default handler for _IO_READ messages
iofunc_readlink()
Verify a client's ability to read a symbolic link
iofunc_read_verify()
Verify a client's read access to a resource
iofunc_rename()
Do permission checks for a _IO_CONNECT_RENAME message
iofunc_space_verify()
Do permission checks for _IO_SPACE message
iofunc_stat()
Populate a stat structure
iofunc_stat_default()
Default handler for _IO_STAT messages
iofunc_sync()
Indicate if synchronization is needed
iofunc_sync_default()
Default handler for _IO_SYNC messages
iofunc_sync_verify()
Verify permissions to sync
iofunc_time_update()
Update time stamps
iofunc_unblock()
Unblock OCBs
iofunc_unblock_default()
Default unblock handler
iofunc_unlink()
Verify that an entry can be unlinked
iofunc_unlock_ocb_default()
Default handler for the unlock_ocb callout
iofunc_utime()
Update time stamps
iofunc_utime_default()
Default handler for _IO_UTIME messages
iofunc_write_default()
Default handler for _IO_WRITE messages
iofunc_write_verify()
Verify a client's write access to a resource
ionotify()
Arm a resource manager
mount()
Mount a filesystem
mount_parse_generic_args()
Strip off common mount arguments
resmgr_devino()
Get the device and inode number
resmgr_open_bind()
Associate an OCB with a process
rsrcdbmgr_attach()
Reserve a system resource for a process
rsrcdbmgr_create()
Create a system resource
rsrcdbmgr_destroy()
Destroy a system resource
rsrcdbmgr_detach()
Return a system resource to the resource database
rsrcdbmgr_devno_attach()
Get a major and minor number
rsrcdbmgr_devno_detach()
Detach a major and minor number
rsrcdbmgr_query()
Query the resource database
umount()
Unmount a filesystem

Searching and sorting functions

These functions provide searching and sorting capabilities (Some of these functions have wide-character versions in the "Wide-character functions" section of the function summary.):

alphasort()
Compare two directory entries
bsearch()
Perform a binary search on a sorted array
ffs()
Find the first bit set in a bit string
hcreate()
Create a hash search table
hdestroy()
Destroy the hash search table
hsearch()
Search the hash search table
index()
Find a character in a string
lfind()
Find entry in a linear search table
lsearch()
Linear search and update
pathfind(), pathfind_r()
Search for a file in a list of directories
qsort()
Sort an array, using a modified Quicksort algorithm
re_comp()
Compile a regular expression
re_exec()
Execute a regular expression
regcomp()
Compile a regular expression
regerror()
Explain a regular expression error code
regexec()
Compare a string with a compiled regular expression
regfree()
Release memory allocated for a regular expression
rindex()
Find a character in a string
strcspn()
Count the characters at the beginning of a string that aren't in a character set
strstr()
Find one string inside another

Shared memory functions

These functions provide memory mapping capabilities:

mmap(), mmap64()
Map a memory region into a process address space
mprotect()
Change memory protection
munmap()
Unmap previously mapped addresses
shm_ctl()
Give special attributes to a shared memory object
shm_open()
Open a shared memory object
shm_unlink()
Remove a shared memory object

Signal functions

These functions deal with handling and sending signals.

DebugBreak()
Enter the process debugger
DebugKDBreak()
Enter the kernel debugger
DebugKDOutput()
Print text with the kernel debugger
kill()
Send a signal to a process or a group of processes
killpg()
Send a signal to a process group
pause()
Suspend the calling thread until delivery of a signal
raise()
Signal an exceptional condition
sigaction()
Examine or specify the action associated with a signal
sigaddset()
Add a signal to a set
sigdelset()
Delete a signal from a set
sigemptyset()
Initialize a set to contain no signals
sigfillset()
Initialize a set to contain all signals
sigismember()
See if a given signal is in a given set
signal()
Set handling for exceptional conditions
SignalAction(), SignalAction_r()
Examine and/or specify actions for signals
SignalKill(), SignalKill_r()
Send a signal to a process group, process, or thread
SignalProcmask(), SignalProcmask_r()
Modify or examine the signal blocked mask of a thread
SignalSuspend(), SignalSuspend_r()
Suspend a process until a signal is received
SignalWaitinfo(), SignalWaitinfo_r()
Select a pending signal
sigpending()
Examine the set of pending, masked signals for a process
sigprocmask()
Examine or change the signal mask for a process
sigqueue()
Queue a signal to a process
sigsuspend()
Replace the signal mask, and then suspend the process
sigtimedwait()
Wait for a signal or a timeout
sigwait()
Wait for a pending signal
sigwaitinfo()
Wait for a pending signal and get its information
strsignal()
Return the description of a signal

Stream I/O functions

A stream is the name given to a file or device that has been opened for data transmission. When a stream is opened, a pointer to a FILE structure is returned. This pointer is used to reference the stream when other functions are subsequently invoked.

When a program begins execution, a number of streams are already open for use:

stderr
Standard Error: output to the console (used for error messages)
stdin
Standard Input: input from the console
stdout
Standard Output: output to the console

You can redirect these standard streams by calling freopen().

See also the section "File manipulation functions" for other functions that operate on files.

The functions in the section "Operating system I/O functions" may also be invoked (use the fileno() function to get the file descriptor). Since the stream functions may buffer input and output, use these functions with caution to avoid unexpected results. (Some of these functions have wide-character versions in the "Wide-character functions" section of the function summary.)

clearerr()
Clear the end-of-file and error indicators for a stream
fclose()
Close a stream
fcloseall()
Close all open stream files, except stdin, stdout and stderr
fdopen()
Associate a stream with a file descriptor
feof()
Test the end-of-file indicator
ferror()
Test the error indicator for a stream
fflush()
Flush the input or output buffer for a stream
fgetc()
Get the next character from a file stream
fgetchar()
Get a character from stdin
fgetpos()
Store the current position of a stream
fgets()
Get a string of characters from a stream
flushall()
Clear all input buffers and write all output buffers
fopen()
Open a stream
fprintf()
Write output to a stream
fputc()
Write a character to an output stream
fputchar()
Write a character to stdout
fputs()
Write a character string to an output stream
fread()
Read elements of a given size from a stream
freopen()
Reopen a stream
fscanf()
Scan input from a stream
fseek(), fseeko()
Change the read/write position of a stream
fsetpos()
Set the current stream position
ftell(), ftello()
Return the current read/write position of a stream
fwrite()
Write a number of elements into a stream
getc()
Get the next character from a stream
getchar()
Get a character from stdin
getchar_unlocked()
Get a character from stdin
getc_unlocked()
Get the next character from a stream
gets()
Get a string of characters from a stream
getw()
Get a word from a stream
perror()
Print, in stderr, the message associated with the value of errno
printf()
Write formatted output to stdout
putc()
Write a character to an output stream
putchar()
Write a character to stdout
putchar_unlocked()
Write a character to stdout
putc_unlocked()
Write a character to an output stream
puts()
Write a string to stdout
putw()
Put a word on a stream
rewind()
Set the file position indicator to the beginning of the stream
scanf()
Scan formatted input from a stream
setbuf()
Associate a buffer with a stream
setbuffer()
Assign block buffering to a stream
setlinebuf()
Assign line buffering to a stream
setvbuf()
Associate a buffer with a stream
snprintf()
Write formatted output to a character array, up to a given max number of characters
tmpfile()
Create a temporary binary file
ungetc()
Push a character back onto an input stream
vfprintf()
Write formatted output to a file stream (varargs)
vfscanf()
Scan input from a file stream (varargs)
vprintf()
Write formatted output to standard output (varargs)
vscanf()
Scan input from standard input (varargs)

See the section "Directory functions" for functions that are related to directories.

String manipulation functions

A string is an array of characters (with type char) that's terminated with an extra null character (\0). Functions are passed only the address of the string, since the size can be determined by searching for the terminating character. (Some of these functions have wide-character versions in the "Wide-character functions" section of the function summary.)

basename()
Find the part of a string after the last slash (/)
bcmp()
Compare a given number of characters in two strings
bcopy()
Copy a number of characters in one string to another
fnmatch()
Check to see if a file or path name matches a pattern
getsubopt()
Parse suboptions from a string
index()
Find a character in a string
input_line()
Get a string of characters from a file
localeconv()
Set numeric formatting according to the current locale
re_comp()
Compile a regular expression
re_exec()
Execute a regular expression
regcomp()
Compile a regular expression
regerror()
Explain a regular expression error code
regexec()
Compare a string with a compiled regular expression
regfree()
Release memory allocated for a regular expression
rindex()
Find a character in a string
sprintf()
Print formatted output into a string
sscanf()
Scan input from a character string
straddstr()
Concatenate one string on to the end of another
strcasecmp()
Compare two strings, ignoring case
strcat()
Concatenate two strings
strchr()
Find the first occurrence of a character in a string
strcmp()
Compare two strings
strcmpi()
Compare two strings, ignoring case
strcoll()
Compare two strings, using the locale's collating sequence
strcpy()
Copy a string
strcspn()
Count the characters at the beginning of a string that aren't in a given character set
strdup()
Create a duplicate of a string
strerror()
Map an error number to an error message
stricmp()
Compare two strings, ignoring case
strlen()
Compute the length of a string
strlwr()
Convert a string to lowercase
strncasecmp()
Compare two strings, ignoring case, up to a given length
strncat()
Concatenate two strings, up to a maximum length
strncmp()
Compare two strings, up to a given length
strncpy()
Copy a string, to a maximum length
strnicmp()
Compare two strings up to a given length, ignoring case
strnset()
Fill a string with a given character, to a given length
strpbrk()
Find the first character in a string that's in a given character set
strrchr()
Find the last occurrence of a character in a string
strrev()
Reverse a string
strsep()
Separate a string into pieces marked by given delimiters
strset()
Fill a string with a given character
strspn()
Count the characters at the beginning of a string that are in a given character set
strstr()
Find one string inside another
strtok()
Break a string into tokens
strtok_r()
Break a string into tokens (reentrant)
strupr()
Convert a string to uppercase
strxfrm()
Transform one string into another, to a given length
vsprintf()
Write formatted output to a buffer (varargs)
vsnprintf()
Write formatted output to a character array, up to a given max number of characters (varargs)
vsscanf()
Scan input from a string (varargs)

For related functions see these sections:

System database functions

The following functions are defined:

crypt()
Encrypt a password
encrypt()
Encrypt a string
endgrent()
Close the group database file
endpwent()
Close the password database file
endspent()
Close the shadow password database file
fgetspent()
Get an entry from the shadow password database
getgrent()
Return an entry from the group database
getgrgid()
Get information about the group with a given ID
getgrgid_r()
Get information about the group with a given ID
getgrnam()
Get information about the group with a given name
getgrnam_r()
Get information about the group with a given name
getpass()
Prompt for and read a password
getpwent()
Get an entry from the password database
getpwnam()
Get information about the user with a given name
getpwnam_r()
Get information about the user with a given name
getpwuid()
Get information about the user with a given ID
getpwuid_r()
Get information about the user with a given ID
getspent(), getspent_r()
Get an entry from the shadow password database
getspnam(), getspnam_r()
Get information about a user with a given name
putspent()
Put an entry into the shadow password database
qnx_crypt()
Encrypt a password (QNX 4)
setkey()
Set the key used in encryption
setgrent()
Rewind to the start of the group database file
setpwent()
Rewind the password database file
setspent()
Rewind the shadow password database file

System message log functions

The following functions are defined:

closelog()
Close the system log
openlog()
Open the system log
setlogmask()
Set the system log priority mask
slogb()
Send a message to the system logger
slogf()
Send a formatted message to the system logger
slogi()
Send a message to the system logger
syslog()
Write a message to the system log
vslogf()
Send a formatted message to the system logger (varargs)
vsyslog()
Control system log (varargs)

TCP/IP functions

These functions, prototypes and structures deal with TCP/IP network communications, database files, and the data server.

accept()
Accept a connection on a socket
addrinfo
TCP/IP address information
bind()
Bind a name to a socket
bindresvport()
Bind a socket to a privileged IP port
connect()
Initiate connection on a socket
dn_comp()
Compress an Internet domain name
dn_expand()
Expand a compressed Internet domain name
ds_clear()
Delete a data server variable
ds_create()
Create a data server variable
ds_deregister()
Deregister an application with the data server
ds_flags()
Set the flags for a data server variable
ds_get()
Retrieve a data server variable
ds_register()
Register an application with the data server
ds_set()
Set a data server variable
endhostent()
Close the TCP connection and the hosts file
endnetent()
Close the network database
endprotoent()
Close protocol name database file
endservent()
Close network services database file
freeaddrinfo()
Free an address information structure
freeifaddrs()
Free an address information structure
gai_strerror()
Return the string associated with a getaddrinfo() error code
getaddrinfo()
Get address information
getdomainname()
Get the domain name of the current host
gethostbyaddr()
Get a network host entry, given an Internet address
gethostbyaddr_r()
Get a network host entry, in a thread-safe manner
gethostbyname()
Get a network host entry, given a name
gethostbyname2()
Get a network host entry, given a name
gethostbyname_r()
Get a network host entry by name
gethostent()
Get the next entry from the host database
gethostent_r()
Get the next entry from the host database
gethostname()
Get the name of the current host
getifaddrs()
Get a network interface address
getnameinfo()
Perform address-to-nodename translation in a protocol-independent manner
getnetbyaddr()
Get network entry
getnetbyname()
Get network entry
getnetent()
Get an entry from the network database
getpeername()
Get name of connected peer
getprotobyname()
Get protocol entry
getprotobynumber()
Get protocol entry by number
getprotoent()
Read next line of protocol name database file
getservbyname()
Get service entry
getservbyport()
Get service entry for a port
getservent()
Read the next line of network services database file
getsockname()
Get socket name
getsockopt()
Get options on socket name
h_errno
Host error variable
herror()
Print the message associated with the value of h_errno to standard error
hostent
Structure that describes an Internet host
hstrerror()
Get an error message string associated with the error return status
htonl()
Convert a 32-bit value from host-byte order to network-byte order
htons()
Convert a 16-bit value from host-byte order to network-byte order
ICMP
Internet Control Message Protocol
ICMP6
Internet Control Message Protocol for IPv6
if_freenameindex()
Free dynamic memory allocated by if_nameindex()
if_indextoname()
Map an interface index to its name
if_nameindex()
Return a list of interfaces
if_nametoindex()
Map an interface name to its index
ifaddrs()
Structure that describes an Internet host
inet_addr()
Convert a string into an Internet address
inet_aton()
Convert a string into an Internet address
inet_lnaof()
Convert an Internet address into a local network address
inet_makeaddr()
Convert a network number and a local network address into an Internet address
inet_net_ntop()
Convert an Internet network number to CIDR format
inet_netof()
Convert Internet address into a network number
inet_net_pton()
Convert an Internet network number from CIDR format to network format
inet_network()
Convert a string into an Internet network number
inet_ntoa()
Convert an Internet address into a string
inet_ntoa_r()
Convert an Internet address into a string
inet_ntop()
Convert a numeric network address to a string
inet_pton()
Convert a text host address to a numeric network address
INET6
Internet Protocol version 6 family
inet6_option_*()
Manipulate IPv6 hop-by-hop and destination options
inet6_rthdr_*()
Manipulate IPv6 Router header options
IP
Internet Protocol
IPsec
Internet security protocol
ipsec_dump_policy()
Generate readable string from IPsec policy specification
ipsec_get_policylen()
Get length of the IPsec policy
ipsec_set_policy()
Generate IPsec policy specification structure from readable string
ipsec_strerror()
Error code for IPsec policy manipulation library
IPv6
Internet Protocol version 6
isfdtype()
Determine whether a file descriptor refers to a socket
listen()
Listen for connections on a socket
nbaconnect()
Initiate a connection on a socket (nonblocking)
nbaconnect_result()
Get the status of the previous call to nbaconnect()
netent
Structure for information from the network database
ntohl()
Convert network-byte order value
ntohs()
Convert network-byte order value
protoent
Structure for information from the protocol database
Raccept()
Accept a connection on a socket (via a SOCKS server)
Rbind()
Bind a name to a socket (via a SOCKS server)
rcmd()
Execute a command on a remote host
Rconnect()
Initiate a connection on a socket (via a SOCKS server)
read_main_config_file()
Read the snmpd.conf file
recv()
Receive a message from a socket
recvfrom()
Receive a message from a socket
recvmsg()
Receive a message from a socket
res_init()
Initialize the Internet domain name resolver routines
res_mkquery()
Construct an Internet domain name query
res_query()
Make an Internet domain name query
res_querydomain()
Query the local Internet domain name server
res_search()
Make an Internet domain name search
res_send()
Send a preformatted Internet domain name query
Rgetsockname()
Get the name of a socket (via a SOCKS server)
Rlisten()
Listen for connections on a socket (via a SOCKS server)
ROUTE
System packet forwarding database
Rrcmd()
Execute a command on a remote host (via a SOCKS server)
rresvport()
Obtain a socket with a privileged address
Rselect()
Check for descriptors that are ready for reading or writing (via a SOCKS server)
ruserok()
Check the identity of a remote host
SCTP
Stream Control Transmission Protocol
sctp_bindx()
Add or remove one or more given addresses from an association
sctp_connectx()
Connect a host to a multihomed endpoint
sctp_freeladdrs()
Free all resources allocated by sctp_getladdrs()
sctp_freepaddrs()
Free all resources allocated by sctp_getpaddrs()
sctp_getladdrs()
Get all locally bound addresses on a socket
sctp_getpaddrs()
Get all peer addresses in an association
sctp_peeloff()
Branch off an association into a separate socket
sctp_recvmsg()
Receive a message, using advanced SCTP features
sctp_sendmsg()
Send a message, using advanced SCTP features
send()
Send a message to a socket
sendmsg()
Send a message to a socket
sendto()
Send a message to a socket
servent
Structure for information from the services database
setdomainname()
Set the domain name of the current host
sethostent()
Set the local hosts entry
sethostname()
Set the name of the current host
setnetent()
Open the network database
setprotoent()
Open protocol name database file
setservent()
Open network services database file
setsockopt()
Set options on socket name
shutdown()
Shut down part of a full-duplex connection
snmp_close()
Close an SNMP session
snmp_free_pdu()
Free an SNMP message structure
snmp_open()
Open an SNMP session
snmp_pdu
Structure that describes an SNMP Protocol Data Unit (transaction)
snmp_pdu_create()
Create an SNMP Protocol Data Unit message structure
snmp_read()
Read an SNMP message
snmp_select_info()
Get information that select() needs for SNMP
snmp_send()
Send SNMP messages
snmp_session
Structure that defines a set of transactions with similar transport characteristics
snmp_timeout()
Timeout during an SNMP session
sockatmark()
Determine whether a socket is at the out-of-band mark
socket()
Create an endpoint for communication
socketpair()
Create a pair of connected sockets or a bi-directional pipe
SOCKSinit()
Initialize a connection with a SOCKS server
sysctl()
Get or set the system information
TCP
Internet Transmission Control Protocol
UDP
Internet User Datagram Protocol
UNIX
UNIX-domain protocol family

Terminal control functions

The following functions are defined:

cfgetispeed()
Return the input baud rate that's stored in a termios structure
cfgetospeed()
Return the output baud rate that's stored in a termios structure
cfmakeraw()
Set terminal attributes
cfsetispeed()
Set the input baud rate in a termios structure
cfsetospeed()
Set the output baud rate in a termios structure
tcdrain()
Wait until all output has been transmitted to a device
tcdropline()
Disconnect a communications line
tcflow()
Perform a flow-control operation on a data stream
tcflush()
Flush the input and/or output stream
tcgetattr()
Get the current terminal control settings
tcgetpgrp()
Get the process group ID associated with a device
tcgetsid()
Get the process group ID of the session leader for a controlling terminal
tcgetsize()
Get the size of a character device
tcinject()
Inject characters into a devices input buffer
tcischars()
Determine the number of characters waiting to be read
tcsendbreak()
Assert a break condition over a communications line
tcsetattr()
Change the terminal control settings for a device
tcsetpgrp()
Set the process group ID for a device
tcsetsid()
Make a terminal device a controlling device
tcsetsize()
Set the size of a character device
termios
Terminal control structure

Thread functions

These functions deal with threads and the objects used to synchronize threads:

pause()
Suspend the calling thread until delivery of a signal
pthread_abort()
Unconditionally terminate the target thread
pthread_atfork()
Register fork handlers
pthread_attr_destroy()
Destroy the thread attribute object
pthread_attr_getdetachstate()
Get the thread detach state attribute
pthread_attr_getguardsize()
Get the thread guardsize attribute
pthread_attr_getinheritsched()
Get the thread inherit scheduling attribute
pthread_attr_getschedparam()
Get the thread scheduling parameters attribute
pthread_attr_getschedpolicy()
Get the thread scheduling policy attribute
pthread_attr_getscope()
Get the thread contention scope attribute
pthread_attr_getstackaddr()
Get the thread stack address attribute
pthread_attr_getstacklazy()
Get thread stack attribute
pthread_attr_getstacksize()
Get the thread stack size attribute
pthread_attr_init()
Initialize thread attribute object
pthread_attr_setdetachstate()
Set the thread detach state attribute
pthread_attr_setguardsize()
Set the thread guardsize attribute
pthread_attr_setinheritsched()
Set the thread inherit scheduling attribute
pthread_attr_setschedparam()
Set the thread scheduling parameters attribute
pthread_attr_setschedpolicy()
Set the thread scheduling policy attribute
pthread_attr_setscope()
Set the thread contention scope attribute
pthread_attr_setstackaddr()
Set the thread stack address attribute
pthread_attr_setstacklazy()
Set thread stack attribute
pthread_attr_setstacksize()
Set the thread stack size attribute
pthread_barrierattr_destroy()
Destroy barrier attributes object
pthread_barrierattr_getpshared()
Get process-shared attribute of barrier attributes object
pthread_barrierattr_init()
Initialize barrier attributes object
pthread_barrierattr_setpshared()
Set process-shared attribute of barrier attributes object
pthread_barrier_destroy()
Destroy a barrier object
pthread_barrier_init()
Initialize a barrier object
pthread_barrier_wait()
Synchronize at a barrier
pthread_cancel()
Cancel thread
pthread_cleanup_pop()
Pop the cancellation cleanup handler
pthread_cleanup_push()
Push the cancellation cleanup handler
pthread_condattr_destroy()
Destroy the condition variable attribute object
pthread_condattr_getclock()
Get the clock selection condition variable attribute
pthread_condattr_getpshared()
Get the process-shared attribute from a condition variable attribute object
pthread_condattr_init()
Initialize the condition variable attribute object
pthread_condattr_setclock()
Set the clock selection condition variable attribute
pthread_condattr_setpshared()
Set the process-shared attribute in a condition variable attribute object
pthread_cond_broadcast()
Unblock threads waiting on a condition
pthread_cond_destroy()
Destroy the condition variable
pthread_cond_init()
Initialize the condition variable
pthread_cond_signal()
Unblock the thread waiting on condition variable
pthread_cond_timedwait()
Timed wait on the condition variable
pthread_cond_wait()
Wait on the condition variable
pthread_create()
Create a thread
pthread_detach()
Detach a thread from a process
pthread_equal()
Compare two thread IDs
pthread_exit()
Terminate the thread
pthread_getconcurrency()
Get the level of thread concurrency
pthread_getcpuclockid()
Return the clock ID of the CPU-time clock from a specified thread
pthread_getschedparam()
Get the thread scheduling parameters
pthread_getspecific()
Get the thread specific data value
pthread_join()
Join the thread
pthread_key_create()
Create the thread-specific data key
pthread_key_delete()
Delete the thread-specific data key
pthread_kill()
Send a signal to a thread
pthread_mutexattr_destroy()
Destroy the mutex attribute object
pthread_mutexattr_getprioceiling()
Get the priority ceiling of a mutex attribute object
pthread_mutexattr_getprotocol()
Get a mutex's scheduling protocol
pthread_mutexattr_getpshared()
Get the process-shared attribute from a mutex attribute object
pthread_mutexattr_getrecursive()
Get the recursive attribute from a mutex attribute object
pthread_mutexattr_gettype()
Get a mutex type
pthread_mutexattr_init()
Initialize a mutex attribute object
pthread_mutexattr_setprioceiling()
Set the priority ceiling of a mutex attribute object
pthread_mutexattr_setprotocol()
Set a mutex's scheduling protocol
pthread_mutexattr_setpshared()
Set the process-shared attribute in a mutex attribute object
pthread_mutexattr_setrecursive()
Set the recursive attribute in a mutex attribute object
pthread_mutexattr_settype()
Set a mutex type
pthread_mutex_destroy()
Destroy a mutex
pthread_mutex_getprioceiling()
Get a mutex's priority ceiling
pthread_mutex_init()
Initialize a mutex
pthread_mutex_lock()
Lock a mutex
pthread_mutex_setprioceiling()
Set a mutex's priority ceiling
pthread_mutex_timedlock()
Lock a mutex
pthread_mutex_trylock()
Attempt to lock a mutex
pthread_mutex_unlock()
Unlock a mutex
pthread_once()
Dynamic package initialization
pthread_sleepon_timedwait()
Make a thread sleep while waiting
pthread_timedjoin()
Join a thread, with a time limit
pthread_rwlockattr_destroy()
Destroy a read-write lock attribute object
pthread_rwlockattr_getpshared()
Get the process-shared attribute of a read-write lock attribute object
pthread_rwlockattr_init()
Create a read-write lock attribute object
pthread_rwlockattr_setpshared()
Set the process-shared attribute of a read-write lock attribute object
pthread_rwlock_destroy()
Destroy a read/write lock
pthread_rwlock_init()
Initialize a read/write lock
pthread_rwlock_rdlock()
Acquire a shared read lock on a read/write lock
pthread_rwlock_timedrdlock()
Lock a read-write lock for writing
pthread_rwlock_timedwrlock()
Attempt to acquire an exclusive write lock on a read/write lock
pthread_rwlock_tryrdlock()
Attempt to acquire a shared read lock on a read/write lock
pthread_rwlock_trywrlock()
Attempt to acquire an exclusive write lock on a read/write lock
pthread_rwlock_unlock()
Unlock a read/write lock
pthread_rwlock_wrlock()
Acquire an exclusive write lock on a read/write lock
pthread_self()
Get the calling thread's ID
pthread_setcancelstate()
Set a thread's cancellation state
pthread_setcanceltype()
Set a thread's cancellation type
pthread_setconcurrency()
Set the concurrency level for a thread
pthread_setschedparam()
Set the thread scheduling parameters
pthread_setspecific()
Set a thread-specific data value
pthread_sigmask()
Examine and change blocked signals
pthread_sleepon_broadcast()
Unblock waiting threads
pthread_sleepon_lock()
Lock the pthread_sleepon*() functions
pthread_sleepon_signal()
Signal a sleeping thread
pthread_sleepon_unlock()
Unlock the pthread_sleepon*() functions
pthread_sleepon_wait()
Make a thread sleep while waiting
pthread_spin_destroy()
Destroy a thread spinlock
pthread_spin_init()
Initialize a thread spinlock
pthread_spin_lock()
Lock a thread spinlock
pthread_spin_trylock()
Try to lock a thread spinlock
pthread_spin_unlock()
Unlock a thread spinlock
pthread_testcancel()
Test the thread cancellation
_sleepon_broadcast()
Wake up multiple threads
_sleepon_destroy()
Destroy a sleepon lock
_sleepon_init()
Initialize a sleepon lock
_sleepon_lock()
Lock a sleepon lock
_sleepon_signal()
Wake up a single thread
_sleepon_unlock()
Unlock a sleepon lock
_sleepon_wait()
Wait on a sleepon lock

Time functions

These functions are concerned with dates and times. (Some of these functions have wide-character versions in the "Wide-character functions" section of the function summary.)

asctime(), asctime_r()
Convert time information to a string
clock()
Return the number of clock ticks used by the program
ClockAdjust(), ClockAdjust_r()
Adjust the time of a clock
ClockCycles()
Get the number of clock cycles
clock_getcpuclockid()
Return the clock ID of the CPU-time clock from a specified process
ClockId(), ClockId_r()
Get a clock ID for a given process and thread
ClockPeriod(), ClockPeriod_r()
Get or set a clock period
ClockTime(), ClockTime_r()
Get or set a clock
ctime(), ctime_r()
Convert calendar time to local time
daylight
Indicator of support for daylight saving time in the locale
difftime()
Calculate the difference between two times
ftime()
Get the current time, and store it in a structure
gettimeofday()
Get the current time
gmtime()
Convert calendar time to a broken-down time
gmtime_r()
Convert calendar time to a broken-down time
localtime()
Convert calendar time to local time
localtime_r()
Convert calendar time to local time
mktime()
Convert local time to calendar time
settimeofday()
Set the time and date
strftime()
Format a time into a string
time()
Determine the current calendar time
TimerAlarm(), TimerAlarm_r()
Send an alarm signal
TimerCreate(), TimerCreate_r()
Create a timer for a process
TimerDestroy(), TimerDestroy_r()
Destroy a process timer
TimerInfo(), TimerInfo_r()
Get information about a timer
TimerSettime(), TimerSettime_r()
Set the expiration time for a timer
timer_timeout(), timer_timeout_r()
Set a timeout on a blocking state
TimerTimeout(), TimerTimeout_r()
Set a timeout on a blocking state
times()
Get time-accounting information
timezone
The number of seconds by which the local time zone is earlier than UTC
tm
Structure that describes calendar time
tzname
The abbreviations for the time zone for standard and daylight savings time
tzset()
Set the time according to the current time zone

Variable-length argument list functions

Variable-length argument lists are used when a function doesn't have a fixed number of arguments. These macros provide the capability to access these arguments:

va_arg()
Get the next item in a list of variable arguments
va_copy()
Make a copy of a variable argument list
va_end()
Finish getting items from a variable argument list
va_start()
Start getting items from a variable argument list

Wide-character functions

If your application must use international characters, you'll probably need to work with Unicode and wide characters. The functions in this section are wide-character versions of many functions from the following function summary categories:

The functions are:

btowc()
Convert a single-byte character to a wide character
fgetwc()
Read a wide character from a stream
fgetws()
Read a string of wide characters from a stream
fputwc()
Write a wide character to a stream
fputws()
Write a wide character string to an output stream
fwide()
Set the stream orientation
fwprintf()
Write wide-character output to a stream
fwscanf()
Scan wide-character input from a stream
getwc()
Read a wide character from stdin
getwchar()
Read a wide character from a stream
iswalnum()
Test for an alphabetic or a decimal digit wide character
iswalpha()
Test for an alphabetic wide character
iswcntrl()
Test for a control wide character
iswctype()
Test for an alphabetic or a decimal digit wide character
iswdigit()
Test for a decimal digit wide character
iswgraph()
Test for any graphical wide character
iswlower()
Test for a lowercase letter wide character
iswprint()
Test for a printable wide character
iswpunct()
Test for any punctuation wide character
iswspace()
Test for a whitespace wide character
iswupper()
Test for an uppercase wide character
iswxdigit()
Test for any hexadecimal digit wide character
putwc()
Write a wide character to a stream
putwchar()
Write a wide character to a stdout
swprintf()
Print formatted wide-character output into a string
swscanf()
Scan input from a wide character string
towctrans()
Convert a wide character in a specified manner
towlower()
Convert a wide character to lowercase
towupper()
Convert a wide character to uppercase
ungetwc()
Push a wide character back onto an input stream
vfwprintf()
Write formatted wide-character output to a file (varargs)
vfwscanf()
Scan input from a file (varargs)
vswprintf()
Write formatted wide-character output to a buffer (varargs)
vswscanf()
Scan input from a string (varargs)
vwprintf()
Write formatted wide-character output to standard output (varargs)
vwscanf()
Scan input from standard input (varargs)
wcrtomb()
Convert a wide-character code into a multibyte character (restartable)
wcscat()
Concatenate two wide-character strings
wcschr()
Find the first occurrence of a wide character in a string
wcscmp()
Compare two wide-character strings
wcscoll()
Compare two wide-character strings, using the locale's collating sequence
wcscpy()
Copy a wide-character string
wcscspn()
Count the wide characters at the beginning of a string that aren't in a given character set
wcsftime()
Format the time into a wide-character string
wcslen()
Compute the length of a wide-character string
wcsncat()
Concatenate two wide-character strings, up to a maximum length
wcsncmp()
Compare two wide-character strings, up to a given length
wcsncpy()
Copy a wide-character string, to a maximum length
wcspbrk()
Find the first wide character in a string that's in a given character set
wcsrtombs()
Convert a wide-character string into a multibyte character string (restartable)
wcsrchr()
Find the last occurrence of a wide character in a string
wcsspn()
Count the wide characters at the beginning of a string that are in a given character set
wcsstr()
Find one wide-character string inside another
wcstod(), wcstof(), wcstold()
Convert a wide-character string into a double, float, or long double
wcstoimax(), wcstoumax()
Convert a wide-character string into an integer
wcstok()
Break a wide-character string into tokens
wcstol(), wcstoll()
Convert a wide-character string into a long or long long
wcstombs()
Convert a wide-character string into a multibyte character string
wcstoul(), wcstoull()
Convert a wide-character string into an unsigned long integer or unsigned long long
wcsxfrm()
Transform one wide-character string into another, to a given length
wctob()
Convert a wide character into a single-byte code
wctomb()
Convert a wide character into a multibyte character
wctrans()
Define a wide-character mapping
wctype()
Define a wide-character class
wmemchr()
Locate the first occurrence of a wide character in a buffer
wmemcmp()
Compare wide characters in two buffers
wmemcpy()
Copy wide characters from one buffer to another
wmemmove()
Copy wide characters from one buffer to another
wmemset()
Set wide characters in memory
wprintf()
Write formatted wide-character output to standard output
wscanf()
Scan formatted wide-character input from standard input

What's in a function description?

Each description contains the following sections:

Synopsis:

This section gives the header files that should be included within a source file that references the function or macro. It also shows an appropriate declaration for the function or for a function that could be substituted for a macro. This declaration isn't included in your program; only the header file(s) should be included.

When a pointer argument is passed to a function that doesn't modify the item indicated by that pointer, the argument is shown with const before the argument. For example, the following indicates that the array pointed at by string isn't changed:

const char *string

Arguments:

This section gives a brief description of the arguments to the function.

Library:

The section indicates the library that you need to bind with your application in order to use the function.

To link against a library, use the -l option to qcc, omitting the lib prefix and any extension from the library's name. For example, to link against libsocket, specify -l socket. For more information, see the Compiling and Debugging chapter of the Neutrino Programmer's Guide.

Description:

This section describes the function or macro.

Returns:

This section gives the return value (if any) for the function or macro.

Errors:

This section describes the special values that the function might assign to the global variable errno.


Note: This section doesn't necessarily list all of the values that the function could set errno to.

See also:

This optional section provides a list of related functions or macros as well as pertinent docs to look for more information.

Examples:

This optional section gives one or more examples of the use of the function. The examples are often just code snippets, not complete programs.

Classification:

This section tells where the function or macro is commonly found, which may be helpful when porting code from one environment to another. Here are the classes:

ANSI
These functions or macros are defined by the ANSI C99 standard.
Large-file support
These functions support 64-bit offsets.
POSIX 1003.1
These functions are specified in the document Information technology -- Portable Operating System Interface (IEEE Std 1003.1, 2004 Edition).

This standard incorporates the POSIX 1003.2-1992 and 1003.1-1996 standards, the approved drafts (POSIX 1003.1a, POSIX 1003.1d, POSIX 1003.1g and POSIX 1003.1j) and the Standard Unix specification. A joint technical working group -- the Austin Common Standards Revision Group (CSRG) -- was formed to merge these standards.


Note: For an up-to-date status of the many POSIX drafts/standards documents, see the PASC (Portable Applications Standards Committee of the IEEE Computer Society) report at http://www.pasc.org/standing/sd11.html.

A classification of "POSIX 1003.1" can be followed by one or more codes that indicate which option or options the functions belong to. The codes include the following:

Code Meaning
ADV Advisory Information
AIO Asynchronous Input/Output
BAR Barriers
CPT Process CPU-Time Clocks
CS Clock Selection
FSC File Synchronization
MF Memory Mapped Files
ML Process Memory Locking
MLR Range Memory Locking
MPR Memory Protection
MSG Message Passing
OB Obsolescent
PS Process Scheduling
RTS Realtime Signals Extension
SEM Semaphores
SHM Shared Memory Objects
SIO Synchronous Input/Output
SPI Spin Locks
TCT Thread CPU-Time Clocks
THR Threads
TMO Timeouts
TMR Timers
TPI Thread Priority Inheritance
TPP Thread Priority Protection
TPS Thread Execution Scheduling
TSA Thread Stack Address Attribute
TSF Thread-Safe Functions
TSH Thread Process-Shared Synchronization
TSS Thread Stack Size Attribute
TYM Typed Memory Objects
XSI X/Open Systems Interfaces Extension
XSR XSI Streams

If two codes are separated by a space, you need to use both options; if the codes are separated by a vertical bar (|), the functionality is supported if you use either option.

For more information, see the Standard for Information Technology -- Portable Operating System Interface: Base Definitions.

QNX 4
These functions or macros are neither ANSI nor POSIX. They perform a function related to the QNX OS version 4. They may be found in other implementations of C for personal computers with the QNX 4 OS. Use these functions with caution if portability is a consideration.

Note: Any QNX 4 functions in the C library are provided only to make it easier to port QNX 4 programs. Don't use these in QNX Neutrino programs.

QNX Neutrino
These functions or macros are neither ANSI nor POSIX. They perform a function related to the QNX Neutrino OS. They may be found in other implementations of C for personal computers with the QNX OS. Use these functions with caution if portability is a consideration.
RFC 2292
W. Stevens and M. Thomas, Advanced Sockets API for IPv6, RFC 2292, February 1998.
SCTP
Socket API extension for the Stream Control Transmission Protocol, in accordance with draft-ietf-tsvwg-sctpsocket-07.txt.
SNMP
Simple Network Management Protocol is a network-management protocol whose base document is RFC 1067. It's used to query and modify network device states.
SOCKS
These functions are part of the SOCKS package consisting of a proxy server, client programs (rftp and rtelnet), and a library (libsocks) for adapting other applications into new client programs. For more information, see the appendix SOCKS -- A Basic Firewall.
Unix
These Unix-class functions reside on some Unix systems, but are outside of the POSIX or ANSI standards.

We've created the following Unix categories to differentiate:

Legacy Unix
Functions included for backwards compatibility only. New applications shouldn't use these functions.
Unix
Other Unix functions.

Function safety:

This section summarizes whether or not it's safe to use the C library functions in certain situations:

Cancellation point
Indicates whether calling a function may or may not cause the thread to be terminated if a cancellation is pending.
Interrupt handler
An interrupt-safe function behaves as documented even if used in an interrupt handler. Functions flagged as interrupt-unsafe shouldn't be used in interrupt handlers.
Signal handler
A signal-safe function behaves as documented even if called from a signal handler even if the signal interrupts a signal-unsafe function.

Some of the signal-safe functions modify errno on failure. If you use any of these in a signal handler, asynchronous signals may have the side effect of modifying errno in an unpredictable way. If any of the code that can be interrupted checks the value of errno (this also applies to library calls, so you should assume that most library calls may internally check errno), make sure that your signal handler saves errno on entry and restores it on exit.

All of the above also applies to signal-unsafe functions, with one exception: if a signal handler calls a signal-unsafe function, make sure that signal doesn't interrupt a signal-unsafe function.

Thread
A thread-safe function behaves as documented even if called in a multi-threaded environment.

Most functions in the QNX Neutrino libraries are thread-safe. Even for those that aren't, there are still ways to call them safely in a multi-threaded program (e.g. by protecting the calls with a mutex). Such cases are explained in each function's description.


Note: The "safety" designations documented in this manual are valid for the this release and could change in future versions. Floating-point functions aren't safe to use in interrupt handlers or signal handlers.

For a summary, see the Summary of Safety Information appendix.