pthread_atfork(3T)pthread_atfork(3T)NAMEpthread_atfork() - register fork handlers.
SYNOPSISPARAMETERS
prepare This function is called before performing the
parent This function is called in the parent process after
performing the
child This function is called in the child process after
performing the
DESCRIPTION
The function allows an application to install fork handlers. These
fork handlers will be called before and after a operation. These han‐
dlers will be called in the context of the thread calling Similar to
the handlers, the application does not need to do anything special for
these fork handlers to be called. They will be invoked by the system
when a operation occurs.
The function is called before the operation in the parent process. The
function is called after the operation in the parent process. The
function is called after the operation in the child process.
If a fork handler is not needed in one or more of these three places,
the appropriate fork handler parameter may be set to NULL.
A process may install multiple fork handling functions. The and fork
handlers will be called in the order in which they were installed
(i.e., The fork handlers will be called in the opposite order (i.e.,
RETURN VALUE
Upon successful completion, returns zero. Otherwise, an error number is
returned to indicate the error (the variable is not set).
ERRORS
If any of the following occur, the function returns the corresponding
error number:
[ENOMEM] There is insufficient table space to install the
fork handlers.
AUTHOR
was derived from the IEEE POSIX P1003.1c standard.
SEE ALSOfork(2), atexit(3).
STANDARDS CONFORMANCE
Pthread Library pthread_atfork(3T)