summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libpthread/man/pthread_atfork.391
1 files changed, 30 insertions, 61 deletions
diff --git a/lib/libpthread/man/pthread_atfork.3 b/lib/libpthread/man/pthread_atfork.3
index 4921f668871..62d5948f5b0 100644
--- a/lib/libpthread/man/pthread_atfork.3
+++ b/lib/libpthread/man/pthread_atfork.3
@@ -1,107 +1,76 @@
-.\" Copyright (c) 2004 Alex Vasylenko <lxv@omut.org>
-.\" All rights reserved.
+.\" $OpenBSD: pthread_atfork.3,v 1.8 2005/11/14 23:46:40 jmc Exp $
.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
+.\" David Leonard <d@openbsd.org>, 1999. Public domain.
.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" Portions of this text are reprinted and reproduced in electronic form
-.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-.\" Portable Operating System Interface (POSIX), The Open Group Base
-.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
-.\" event of any discrepancy between this version and the original IEEE and
-.\" The Open Group Standard, the original IEEE and The Open Group Standard is
-.\" the referee document. The original Standard can be obtained online at
-.\" http://www.opengroup.org/unix/online.html.
-.\"
-.\" $OpenBSD: pthread_atfork.3,v 1.7 2005/11/01 19:27:58 fgsch Exp $
-.\" $FreeBSD: /repoman/r/ncvs/src/share/man/man3/pthread_atfork.3,v 1.3 2005/06/16 18:46:16 ru Exp $
-.\"
-.Dd June 21, 2004
+.Dd January 17, 1999
.Dt PTHREAD_ATFORK 3
.Os
.Sh NAME
.Nm pthread_atfork
-.Nd register fork handlers
+.Nd specify handler functions to call when the process forks
.Sh SYNOPSIS
.Fd #include <pthread.h>
-.Pp
.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
-.Xr fork 2 ,
+.Fn fork ,
in the context of the thread that called
-.Xr fork 2 .
+.Fn fork .
The
.Fa prepare
fork handler will be called before
-.Xr fork 2
+.Fn fork
processing commences.
The
.Fa parent
-fork handle will be called after
-.Xr fork 2
+fork handler will be called after
+.Fn fork
processing completes in the parent process.
The
.Fa child
fork handler will be called after
-.Xr fork 2
+.Fn fork
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
+.Dv NULL .
.Pp
-If no handling is desired at one or more of these three points, the
-corresponding fork handler address(es) may be set to NULL.
-.Pp
-Multiple sets of handlers can be installed by calling
+The order of calls to
.Fn pthread_atfork
-several times.
+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
-while the
+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
-returns a value of zero; otherwise, an error number is returned
-to indicate the error.
+will return a value of zero.
+Otherwise, an error number will be
+returned to indicate the error.
.Sh ERRORS
-The
.Fn pthread_atfork
-function will fail if:
+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
.Sh SEE ALSO
-.Xr fork 2
+.Xr fork 2 ,
+.Xr atexit 3
.Sh STANDARDS
-The
.Fn pthread_atfork
-function is expected to conform to
-.St -p1003.1 .
+conforms to
+.St -p1003.1-2004 .