|PTHREAD_ATFORK(3)||Library Functions Manual||PTHREAD_ATFORK(3)|
specify handler functions to call when the process
function declares fork handlers to be called before and after
fork(2), in the context of the
thread that called fork(2). The
prepare fork handler will be called before
fork(2) processing commences.
The parent fork handler will be called after
fork(2) processing completes in
the parent process. The child fork handler will be
called after fork(2) processing
completes in the child process. If no handling is desired at one or more of
these three points, the corresponding fork handler address(es) may be set to
The order of calls to
is significant. The parent and
child fork handlers will be called in the order in
which they were established by calls to
pthread_atfork(). The prepare
fork handlers will be called in the opposite order.
If a shared object is unloaded from process
memory using dlclose(3),
then any functions registered by calling
from that shared object will be unregistered without being invoked. Note
that it is the source of the call to
pthread_atfork() that matters, not the source of the
functions that were registered.
Upon successful completion,
pthread_atfork() will return a value of zero.
Otherwise, an error number will be returned to indicate the error.
pthread_atfork() will fail if:
pthread_atfork() conforms to
IEEE Std 1003.1-2004 (“POSIX.1”).
The behavior when a shared object is unloaded is an extension to that standard.
|May 15, 2015||OpenBSD-6.7|