Document that our use of pthread_mutex_unlock(3) is async-signal-safe
and as such can be used in a phtread_atfork(3) child handler.
This commit is contained in:
parent
a57dc65e45
commit
1ae594017c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: arc4random.c,v 1.24 2014/06/12 19:12:19 apb Exp $ */
|
||||
/* $NetBSD: arc4random.c,v 1.25 2014/07/19 14:53:22 roy Exp $ */
|
||||
/* $OpenBSD: arc4random.c,v 1.6 2001/06/05 05:05:38 pvalchev Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: arc4random.c,v 1.24 2014/06/12 19:12:19 apb Exp $");
|
||||
__RCSID("$NetBSD: arc4random.c,v 1.25 2014/07/19 14:53:22 roy Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
|
@ -125,6 +125,12 @@ arc4_fork_child(void)
|
|||
static inline void
|
||||
arc4_check_init(struct arc4_stream *as)
|
||||
{
|
||||
/*
|
||||
* pthread_atfork(3) only allows async-signal-safe functions in
|
||||
* the child handler.
|
||||
* NetBSD's mutex_unlock is async-signal safe, other implementations
|
||||
* may not be.
|
||||
*/
|
||||
|
||||
if (__predict_false(!as->inited)) {
|
||||
as->inited = true;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: pthread_atfork.3,v 1.5 2008/04/30 13:10:50 martin Exp $
|
||||
.\" $NetBSD: pthread_atfork.3,v 1.6 2014/07/19 14:53:22 roy Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd February 12, 2003
|
||||
.Dd July 18, 2014
|
||||
.Dt PTHREAD_ATFORK 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -91,7 +91,9 @@ The following error code may be returned:
|
|||
Insufficient memory exists to register the fork handlers.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr fork 2
|
||||
.Xr fork 2 ,
|
||||
.Xr pthread_mutex 3 ,
|
||||
.Xr signal 7
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Fn pthread_atfork
|
||||
|
@ -115,6 +117,11 @@ functions are not async-signal-safe, so it is not safe to use such functions
|
|||
in the
|
||||
.Ar child
|
||||
handler.
|
||||
POSIX does not mandate that
|
||||
.Fn pthread_mutex_unlock
|
||||
be async-signal-safe, but it is in NetBSD and thus safe to use within the
|
||||
.Ar child
|
||||
handler.
|
||||
.Sh BUGS
|
||||
There is no way to unregister a handler registered with
|
||||
.Fn pthread_atfork .
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: signal.7,v 1.16 2011/01/19 04:33:13 uwe Exp $
|
||||
.\" $NetBSD: signal.7,v 1.17 2014/07/19 14:53:22 roy Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -24,7 +24,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd February 27, 2009
|
||||
.Dd July 18, 2014
|
||||
.Dt SIGNAL 7
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -148,6 +148,7 @@ below is unsafe to use in signal handlers.
|
|||
.Xr poll 2 ,
|
||||
.\" .Xr posix_trace_event 2
|
||||
.\" .Xr pselect 2
|
||||
.Xr pthread_mutex_unlock 3 ,
|
||||
.Xr raise 3 ,
|
||||
.Xr read 2 ,
|
||||
.Xr readlink 2 ,
|
||||
|
|
Loading…
Reference in New Issue