diff options
author | David Leonard <d@cvs.openbsd.org> | 1999-01-18 00:06:36 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 1999-01-18 00:06:36 +0000 |
commit | 4b1f297dfa221dbe111e23eb86a217ce6e637e56 (patch) | |
tree | 4df5cc4da8cae9fa9cc0e33fc29ea95c78ba5ba6 /lib/libc_r | |
parent | ed4fdea26bcbd6abe878da863805f86822acf277 (diff) |
document
Diffstat (limited to 'lib/libc_r')
-rw-r--r-- | lib/libc_r/man/pthread_atfork.3 | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/lib/libc_r/man/pthread_atfork.3 b/lib/libc_r/man/pthread_atfork.3 new file mode 100644 index 00000000000..bde5ff2aab1 --- /dev/null +++ b/lib/libc_r/man/pthread_atfork.3 @@ -0,0 +1,68 @@ +.Dd January 17, 1999 +.Dt PTHREAD_ATFORK 3 +.Os BSD 4 +.Sh NAME +.Nm pthread_atfork +.Nd specify handler functions to call when the process forks +.Sh SYNOPSIS +.Fd #include <pthread.h> +.Ft int +.Fn pthread_atfork "void (*prepare)(void)" "void (*parent)(void)" "void (*child)(void)" +.Sh DESCRIPTION +The +.Fn pthread_atfork +function declares fork handlers to be called before and after +.Fn fork , +in the context of the thread that called +.Fn fork . +The +.Fa prepare +fork handler will be called before +.Fn fork +processing commences. The +.Fa parent +fork handler will be called after +.Fn fork +prcessing completes in the parent process. The +.Fa child +fork handler will be called after +.Fn fork +processing completes in the child process. If no handling is desired at +one or more of these three points, the correspoding fork handler +address(es) may be set to +.Dv NULL . +.Pp +The order of calls to +.Fn pthread_atfork +is significant. The +.Fa parent +and +.Fa child +fork handlers will be called in the order in which they were established +by calls to +.Fn pthread_atfork . +The +.Fa prepare +fork handlers will be called in the opposite order. +.Sh RETURN VALUES +Upon successful completion, +.Fn pthread_atfork +will return a value of zero. Otherwise, an error number will be +returned to indicate the error. +.Sh ERRORS +.Fn pthread_atfork +will fail if: +.Bl -tag -width Er +.It Bq Er ENOMEM +Insufficient table space exists to record the fork handler addresses. +None of the handler lists are modified. +.El +.Pp +.Sh SEE ALSO +.Xr fork 2 , +.Xr atexit 3 +.Sh STANDARDS +.Fn pthread_atfork +conforms to ISO/IEC 9945-1 ANSI/IEEE +.Pq Dq Tn POSIX +Std 1003.1 Second Edition 1996-07-12. |