From: guenther Date: Sun, 11 Oct 2015 09:51:26 +0000 (+0000) Subject: Document that execve(2) resets SIGCHLD to SIG_DFL X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=93024534bb8508f1ab1cee1f3713f250b46dae6e;p=openbsd Document that execve(2) resets SIGCHLD to SIG_DFL wordsmithing and ok jmc@ --- diff --git a/lib/libc/gen/signal.3 b/lib/libc/gen/signal.3 index 0dc8dce14d8..a91f37692f5 100644 --- a/lib/libc/gen/signal.3 +++ b/lib/libc/gen/signal.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: signal.3,v 1.53 2015/05/12 02:44:06 guenther Exp $ +.\" $OpenBSD: signal.3,v 1.54 2015/10/11 09:51:26 guenther Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: May 12 2015 $ +.Dd $Mdocdate: October 11 2015 $ .Dt SIGNAL 3 .Os .Sh NAME @@ -228,10 +228,13 @@ a specific signal. .Pp When a process which has installed signal handlers forks, the child process inherits the signals. -All caught signals may be reset to their default action by a call +All caught signals, as well as +.Dv SIGCHLD , +are reset to their default action by a call to the .Xr execve 2 function; +other ignored signals remain ignored. .Pp The following functions are either reentrant or not interruptible diff --git a/lib/libc/sys/execve.2 b/lib/libc/sys/execve.2 index 0a9693728a2..53d3a2be848 100644 --- a/lib/libc/sys/execve.2 +++ b/lib/libc/sys/execve.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: execve.2,v 1.46 2015/09/10 17:55:21 schwarze Exp $ +.\" $OpenBSD: execve.2,v 1.47 2015/10/11 09:51:26 guenther Exp $ .\" $NetBSD: execve.2,v 1.9 1995/02/27 12:32:25 cgd Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)execve.2 8.3 (Berkeley) 1/24/94 .\" -.Dd $Mdocdate: September 10 2015 $ +.Dd $Mdocdate: October 11 2015 $ .Dt EXECVE 2 .Os .Sh NAME @@ -121,10 +121,13 @@ some system file like The intent is to ensure these descriptors are not unallocated, since many libraries make assumptions about the use of these 3 file descriptors. .Pp -Signals set to be ignored in the calling process are set to be ignored in +Signals set to be ignored in the calling process, +with the exception of +.Dv SIGCHLD , +are set to be ignored in the new process. -Signals which are set to be caught in the calling process image +Other signals are set to default action in the new process image. Blocked signals remain blocked regardless of changes to the signal action. The signal stack is reset to be undefined (see @@ -323,3 +326,12 @@ to a non-superuser, but is executed when the real is .Dq root , then the process has some of the powers of a superuser as well. +.Pp +.St -p1003.1-2008 +permits +.Nm +to leave +.Dv SIGCHLD +as ignored in the new process; portable programs cannot rely on +.Nm +resetting it to the default disposition. diff --git a/lib/libc/sys/sigaction.2 b/lib/libc/sys/sigaction.2 index ce4dfd52968..c33a6bd81bd 100644 --- a/lib/libc/sys/sigaction.2 +++ b/lib/libc/sys/sigaction.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sigaction.2,v 1.71 2015/10/11 07:53:49 guenther Exp $ +.\" $OpenBSD: sigaction.2,v 1.72 2015/10/11 09:51:26 guenther Exp $ .\" $NetBSD: sigaction.2,v 1.7 1995/10/12 15:41:16 jtc Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 @@ -289,9 +289,10 @@ and the restart/interrupt flags are inherited by the child. .Pp .Xr execve 2 reinstates the default -action for all signals which were caught and -resets all signals to be caught on the user stack. -Ignored signals remain ignored; +action for +.Dv SIGCHLD +and all signals which were caught; all other signals remain ignored. +All signals are reset to be caught on the user stack and the signal mask remains the same; signals that restart pending system calls continue to do so. .Pp