summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2015-05-12 20:13:15 +0000
committerguenther <guenther@openbsd.org>2015-05-12 20:13:15 +0000
commit9fc11cfaf0235a1152f2792707080bbeeb3416b0 (patch)
treec8a0030e9494c0fa11507e6a7bb2a560242833d5 /lib/libpthread
parentRace less. (diff)
downloadwireguard-openbsd-9fc11cfaf0235a1152f2792707080bbeeb3416b0.tar.xz
wireguard-openbsd-9fc11cfaf0235a1152f2792707080bbeeb3416b0.zip
Document pthread_atfork(3)'s interaction with dlclose(3)
Use Xr instead of Fn for functions documented on other manpages ok millert@ jmc@ schwarze@
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/man/pthread_atfork.329
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/libpthread/man/pthread_atfork.3 b/lib/libpthread/man/pthread_atfork.3
index 7e9f962a4c7..0161b66d81a 100644
--- a/lib/libpthread/man/pthread_atfork.3
+++ b/lib/libpthread/man/pthread_atfork.3
@@ -1,8 +1,8 @@
-.\" $OpenBSD: pthread_atfork.3,v 1.10 2013/06/05 03:44:50 tedu Exp $
+.\" $OpenBSD: pthread_atfork.3,v 1.11 2015/05/12 20:13:15 guenther Exp $
.\"
.\" David Leonard <d@openbsd.org>, 1999. Public domain.
.\"
-.Dd $Mdocdate: June 5 2013 $
+.Dd $Mdocdate: May 12 2015 $
.Dt PTHREAD_ATFORK 3
.Os
.Sh NAME
@@ -16,23 +16,23 @@
The
.Fn pthread_atfork
function declares fork handlers to be called before and after
-.Fn fork ,
+.Xr fork 2 ,
in the context of the thread that called
-.Fn fork .
+.Xr fork 2 .
The
.Fa prepare
fork handler will be called before
-.Fn fork
+.Xr fork 2
processing commences.
The
.Fa parent
fork handler will be called after
-.Fn fork
+.Xr fork 2
processing completes in the parent process.
The
.Fa child
fork handler will be called after
-.Fn fork
+.Xr fork 2
processing completes in the child process.
If no handling is desired at
one or more of these three points,
@@ -53,6 +53,15 @@ by calls to
The
.Fa prepare
fork handlers will be called in the opposite order.
+.Pp
+If a shared object is unloaded from process memory using
+.Xr dlclose 3 ,
+then any functions registered by calling
+.Fn pthread_atfork
+from that shared object will be unregistered without being invoked.
+Note that it is the source of the call to
+.Fn pthread_atfork
+that matters, not the source of the functions that were registered.
.Sh RETURN VALUES
Upon successful completion,
.Fn pthread_atfork
@@ -69,8 +78,12 @@ None of the handler lists are modified.
.El
.Sh SEE ALSO
.Xr fork 2 ,
-.Xr atexit 3
+.Xr atexit 3 ,
+.Xr dlclose 3
.Sh STANDARDS
.Fn pthread_atfork
conforms to
.St -p1003.1-2004 .
+.Pp
+The behavior when a shared object is unloaded is an extension to
+that standard.