atfork(3C) atfork(3C)
atfork_child, atfork_child_prepend, atfork_parent, atfork_pre - add fork
pre and post interception routines
#include <unistd.h>
int atfork_child (void (*func)(void));
int atfork_child_prepend (void (*func)(void));
int atfork_parent (void (*func)(int errno,int pid));
int atfork_pre (void (*func)(void));
atfork_child adds the function func to the end of a list of functions to
be called without arguments on entry of a child process created by
fork(2). atfork_child_prepend performs the same task, but it adds the
function at the beginning of the list. At most 32 functions may be
registered by atfork_child or atfork_child_prepend. The functions will
be called in list order.
atfork_parent adds the function func to a list of functions to be called
with two integer arguments after calling fork(2). At most 32 functions
may be registered by atfork_parent; the functions will be called in the
same order as their registration.
atfork_pre adds the function func to a list of functions to be called
without arguments just preceeding a call to fork(2). At most 32
functions may be registered by atfork_pre; the functions will be called
in the reverse order as their registration.
atfork_child, atfork_child_prepend, atfork_parent, and atfork_pre all
return 0 if the registration succeeds. Otherwise, a value of -1 is
returned and errno is set to indicate the error.
fork(2).
PPPPaaaaggggeeee 1111 [ Back ]
|