summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2002-08-04 01:07:02 +0000
committermdodd <mdodd@FreeBSD.org>2002-08-04 01:07:02 +0000
commite327abdb5fe6f6022bec2eac7491975d34fa77d2 (patch)
tree0c828d394785fe576b10f2b478555ce28231defa /sys
parent65f8611398fde0becef8e3b6adea757da2411823 (diff)
downloadFreeBSD-src-e327abdb5fe6f6022bec2eac7491975d34fa77d2.zip
FreeBSD-src-e327abdb5fe6f6022bec2eac7491975d34fa77d2.tar.gz
Kernel modifications necessary to allow to follow fork()ed children.
PR: bin/25587 (in part) MFC after: 3 weeks
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_fork.c10
-rw-r--r--sys/sys/pioctl.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index bf09ff8..bf8f6fb 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -51,6 +51,7 @@
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/proc.h>
+#include <sys/pioctl.h>
#include <sys/resourcevar.h>
#include <sys/syscall.h>
#include <sys/vnode.h>
@@ -758,6 +759,15 @@ again:
PROC_UNLOCK(p2);
/*
+ * If PF_FORK is set, the child process inherits the
+ * procfs ioctl flags from its parent.
+ */
+ if (p1->p_pfsflags & PF_FORK) {
+ p2->p_stops = p1->p_stops;
+ p2->p_pfsflags = p1->p_pfsflags;
+ }
+
+ /*
* Return child proc pointer to parent.
*/
*procp = p2;
diff --git a/sys/sys/pioctl.h b/sys/sys/pioctl.h
index b7a2cea..497bf27 100644
--- a/sys/sys/pioctl.h
+++ b/sys/sys/pioctl.h
@@ -75,4 +75,5 @@ struct procfs_status {
# define PF_LINGER 0x01 /* Keep stops around after last close */
# define PF_ISUGID 0x02 /* Ignore UID/GID changes */
+# define PF_FORK 0x04 /* Retain settings on fork() */
#endif
OpenPOWER on IntegriCloud