diff options
-rw-r--r-- | sys/amd64/linux32/linux.h | 1 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_machdep.c | 10 | ||||
-rw-r--r-- | sys/i386/linux/linux.h | 1 | ||||
-rw-r--r-- | sys/i386/linux/linux_machdep.c | 10 |
4 files changed, 22 insertions, 0 deletions
diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 0e7a09f..9c8ed5c 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -830,6 +830,7 @@ typedef int l_mqd_t; #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 diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index 7b0b124..c4a58c7 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -640,6 +640,16 @@ linux_clone(struct thread *td, struct linux_clone_args *args) 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); + p2->p_flag |= P_PPWAIT; + while (p2->p_flag & P_PPWAIT) + msleep(td->td_proc, &p2->p_mtx, PWAIT, "ppwait", 0); + PROC_UNLOCK(p2); + } + return (0); } diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index ba91a5a..9ad9353 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -793,6 +793,7 @@ typedef int l_mqd_t; #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 diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index 849170b..cef0124 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -532,6 +532,16 @@ linux_clone(struct thread *td, struct linux_clone_args *args) 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); + p2->p_flag |= P_PPWAIT; + while (p2->p_flag & P_PPWAIT) + msleep(td->td_proc, &p2->p_mtx, PWAIT, "ppwait", 0); + PROC_UNLOCK(p2); + } + return (0); } |