Date: Sat, 23 Sep 2006 08:55:16 GMT From: Roman Divacky <rdivacky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 106538 for review Message-ID: <200609230855.k8N8tGjF039664@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=106538 Change 106538 by rdivacky@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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609230855.k8N8tGjF039664>