PERFORCE change 106538 for review
Roman Divacky
rdivacky at FreeBSD.org
Sat Sep 23 01:55:18 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=106538
Change 106538 by rdivacky at rdivacky_witten on 2006/09/23 08:54:44
Implement CLONE_VFORK semantics for clone().
Affected files ...
.. //depot/projects/linuxolator/src/sys/amd64/linux32/linux.h#5 edit
.. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#3 edit
.. //depot/projects/linuxolator/src/sys/i386/linux/linux.h#4 edit
.. //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#2 edit
Differences ...
==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux.h#5 (text+ko) ====
@@ -831,6 +831,7 @@
#define CLONE_FILES 0x400
#define CLONE_SIGHAND 0x800
#define CLONE_PID 0x1000 /* this flag does not exist in linux anymore */
+#define CLONE_VFORK 0x4000
#define CLONE_PARENT 0x00008000
#define CLONE_THREAD 0x10000
#define CLONE_SETTLS 0x80000
==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#3 (text+ko) ====
@@ -701,6 +701,15 @@
td->td_retval[0] = p2->p_pid;
td->td_retval[1] = 0;
+
+ if (args->flags & CLONE_VFORK) {
+ /* wait for the children to exit, ie. emulate vfork */
+ PROC_LOCK(p2);
+ while (p2->p_flag & P_PPWAIT)
+ msleep(td->td_proc, &p2->p_mtx, PWAIT, "ppwait", 0);
+ PROC_UNLOCK(p2);
+ }
+
return (0);
}
==== //depot/projects/linuxolator/src/sys/i386/linux/linux.h#4 (text+ko) ====
@@ -794,6 +794,7 @@
#define CLONE_FILES 0x400
#define CLONE_SIGHAND 0x800
#define CLONE_PID 0x1000 /* this flag does not exist in linux anymore */
+#define CLONE_VFORK 0x4000
#define CLONE_PARENT 0x00008000
#define CLONE_THREAD 0x10000
#define CLONE_SETTLS 0x80000
==== //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#2 (text+ko) ====
@@ -524,6 +524,15 @@
td->td_retval[0] = p2->p_pid;
td->td_retval[1] = 0;
+
+ if (args->flags & CLONE_VFORK) {
+ /* wait for the children to exit, ie. emulate vfork */
+ PROC_LOCK(p2);
+ while (p2->p_flag & P_PPWAIT)
+ msleep(td->td_proc, &p2->p_mtx, PWAIT, "ppwait", 0);
+ PROC_UNLOCK(p2);
+ }
+
return (0);
}
More information about the p4-projects
mailing list