summaryrefslogtreecommitdiffstats
path: root/share/man
diff options
context:
space:
mode:
Diffstat (limited to 'share/man')
-rw-r--r--share/man/man3/Makefile1
-rw-r--r--share/man/man3/pthread.310
-rw-r--r--share/man/man3/pthread_atfork.3106
3 files changed, 117 insertions, 0 deletions
diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile
index 6aa8b26..c3b9287 100644
--- a/share/man/man3/Makefile
+++ b/share/man/man3/Makefile
@@ -142,6 +142,7 @@ MLINKS+= tree.3 RB_EMPTY.3 \
.if !defined(NO_LIBC_R) || !defined(NO_LIBPTHREAD) || !defined(NO_LIBTHR)
PTHREAD_MAN= pthread.3 \
+ pthread_atfork.3 \
pthread_attr.3 \
pthread_attr_get_np.3 \
pthread_attr_setcreatesuspend_np.3 \
diff --git a/share/man/man3/pthread.3 b/share/man/man3/pthread.3
index 076aefe..5ebb88d 100644
--- a/share/man/man3/pthread.3
+++ b/share/man/man3/pthread.3
@@ -447,6 +447,15 @@ Set the thread-specific value for the specified key.
.Ss Cleanup Routines
.Bl -tag -width indent
.It Xo
+.Ft int
+.Fo pthread_atfork
+.Fa "void \*[lp]*prepare\*[rp]\*[lp]void\*[rp]"
+.Fa "void \*[lp]*parent\*[rp]\*[lp]void\*[rp]"
+.Fa "void \*[lp]*child\*[rp]\*[lp]void\*[rp]"
+.Fc
+.Xc
+Register fork handlers
+.It Xo
.Ft void
.Fn pthread_cleanup_pop "int execute"
.Xc
@@ -472,6 +481,7 @@ They contain both thread-safe versions of
functions and the thread functions.
Threaded applications are linked with one of these libraries.
.Sh SEE ALSO
+.Xr pthread_atfork 3 ,
.Xr pthread_cleanup_pop 3 ,
.Xr pthread_cleanup_push 3 ,
.Xr pthread_condattr_destroy 3 ,
diff --git a/share/man/man3/pthread_atfork.3 b/share/man/man3/pthread_atfork.3
new file mode 100644
index 0000000..fbdf018
--- /dev/null
+++ b/share/man/man3/pthread_atfork.3
@@ -0,0 +1,106 @@
+.\" Copyright (c) 2004 Alex Vasylenko <lxv@omut.org>
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 21, 2004
+.Dt PTHREAD_ATFORK 3
+.Os
+.Sh NAME
+.Nm pthread_atfork
+.Nd register fork handlers
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fo pthread_atfork
+.Fa "void \*[lp]*prepare\*[rp]\*[lp]void\*[rp]"
+.Fa "void \*[lp]*parent\*[rp]\*[lp]void\*[rp]"
+.Fa "void \*[lp]*child\*[rp]\*[lp]void\*[rp]"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn pthread_atfork
+function declares fork handlers to be called before and after
+.Xr fork 2 ,
+in the context of the thread that called
+.Xr fork 2 .
+.Pp
+The handlers registered with
+.Nm
+are called at the moments in time described below:
+.Bl -tag -width "prepare"
+.It Fa prepare
+Before
+.Xr fork 2
+processing commences in the parent process.
+If more than one
+.Fa prepare
+handler is registered they will be called in the opposite order
+they were registered.
+.It Fa parent
+After
+.Xr fork 2
+completes in the parent process.
+If more than one
+.Fa parent
+handler is registered they will be called in the same order
+they were registered.
+.It Fa child
+After
+.Xr fork 2
+processing completes in the child process.
+If more than one
+.Fa child
+handler is registered they will be called in the same order
+they were registered.
+.El.
+.Pp
+If no handling is desired at one or more of these three points,
+a null pointer may be passed as the corresponding fork handler.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_atfork
+function will return zero.
+Otherwise an error number will be returned to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_atfork
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient table space exists to record the fork handler addresses.
+.Sh SEE ALSO
+.Xr fork 2 ,
+.Xr pthread 3
+.Sh STANDARDS
+The
+.Fn pthread_atfork
+function is expected to conform to
+.St -p1003.1 .
+.Sh AUTHORS
+This manpage was written by
+.An Alex Vasylenko
+.Aq lxv@omut.org .
OpenPOWER on IntegriCloud