Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170956897
D59349.id185731.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D59349.id185731.diff
View Options
diff --git a/lib/libsys/pdfork.2 b/lib/libsys/pdfork.2
--- a/lib/libsys/pdfork.2
+++ b/lib/libsys/pdfork.2
@@ -114,6 +114,17 @@
.It Dv PD_NOWAITPID
The parent cannot obtain the child's status with
.Xr waitpid 2 .
+.Pp
+A consequence of not setting the flag is that the child' zombie is
+not reaped until the
+.Xr waitpid 2
+call is performed on the child' PID.
+Setting the
+.Dv
+kern.pdfork_implicit_nowaitpid
+sysctl MIB to
+.Dv true
+makes the system behave as if the flag is always passed.
.It Dv PD_PTRACE_CAP
Enable
.Xr pdptrace 2
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -91,6 +91,11 @@
SDT_PROVIDER_DECLARE(proc);
SDT_PROBE_DEFINE3(proc, , , create, "struct proc *", "struct proc *", "int");
+static bool pdfork_implicit_nowaitpid;
+SYSCTL_BOOL(_kern, OID_AUTO, pdfork_implicit_nowaitpid, CTLFLAG_RWTUN,
+ &pdfork_implicit_nowaitpid, 0,
+ "PD_NOWAITPID is assumed to be always set");
+
#ifndef _SYS_SYSPROTO_H_
struct fork_args {
int dummy;
@@ -560,7 +565,8 @@
P2_LOGSIGEXIT_ENABLE);
if ((fr->fr_flags & RFPROCDESC) != 0) {
p2->p_zombieref = PZOMBIEREF_PROCDESC;
- if ((fr->fr_pd_flags & PD_NOWAITPID) == 0 &&
+ if (((fr->fr_pd_flags & PD_NOWAITPID) == 0 &&
+ !pdfork_implicit_nowaitpid) &&
(fr->fr_flags & RFNOWAIT) == 0)
p2->p_zombieref |= (PZOMBIEREF_PARENT |
PZOMBIEREF_NEEDPARENT);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 8, 8:46 PM (7 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38447712
Default Alt Text
D59349.id185731.diff (1 KB)
Attached To
Mode
D59349: kern_fork.c: add kern.pdfork_implicit_nowaitpid sysctl
Attached
Detach File
Event Timeline
Log In to Comment