mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-27 16:39:08 +00:00
MFP4 (106538 + 106541):
Implement CLONE_VFORK. This fixes the clone05 LTP test. Submitted by: rdivacky
This commit is contained in:
parent
2482245b0c
commit
0a62e03542
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=163374
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user