Module Name:    src
Committed By:   riastradh
Date:           Mon Jul 17 14:20:19 UTC 2023

Modified Files:
        src/share/man/man7: signal.7

Log Message:
signal(7): Clarify semantics of SIGCHLD with SIG_IGN or SA_NOCLDWAIT.

The semantics is not just a nonportable hack for SysV compatibility;
it is enshrined in POSIX.

Related: PR 57527


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/share/man/man7/signal.7

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man7/signal.7
diff -u src/share/man/man7/signal.7:1.27 src/share/man/man7/signal.7:1.28
--- src/share/man/man7/signal.7:1.27	Sat Jul 15 13:49:26 2023
+++ src/share/man/man7/signal.7	Mon Jul 17 14:20:19 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: signal.7,v 1.27 2023/07/15 13:49:26 riastradh Exp $
+.\"	$NetBSD: signal.7,v 1.28 2023/07/17 14:20:19 riastradh Exp $
 .\"
 .\" Copyright (c) 1999, 2016 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -402,22 +402,23 @@ immediate children exits and can be wait
 family of functions.
 The default action is to do nothing.
 .Pp
-As a special case hack, if
+As a special case, if a child exits when its parent process has
 .Dv SIGCHLD
-is ignored (not merely blocked) when a process is
-.Em created ,
-it is detached from its parent immediately so it need not
-.Pq and cannot
-be waited for.
-This behavior is a System V historic wart, implemented in
-.Nx
-only for compatibility.
-It is not portable, not recommended, and should not be used by new
-code.
-New code should use the portable technique of forking a child to fork
-or spawn a grandchild, and letting the child exit immediately
-afterward.
-The grandchild process will then be detached.
+ignored
+.Pq not merely blocked
+by having its signal handler set to
+.Dv SIG_IGN ,
+or if the signal action has the
+.Dv SA_NOCLDWAIT
+flag set
+.Pq Xr sigaction 2 ,
+then the child is detached so that
+.Xr wait 2
+in the parent will wait for
+.Em all
+children to exit and then fail with
+.Er ECHILD
+without returning any information about any specific child processes.
 .Pp
 The number for
 .Dv SIGCHLD

Reply via email to