patch-2.2.0-pre7 linux/arch/i386/kernel/process.c

Next file: linux/arch/i386/kernel/ptrace.c
Previous file: linux/arch/i386/kernel/ioport.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre6/linux/arch/i386/kernel/process.c linux/arch/i386/kernel/process.c
@@ -778,17 +778,19 @@
 	newsp = regs.ecx;
 	if (!newsp)
 		newsp = regs.esp;
-	return do_fork(clone_flags, newsp, &regs);
+	return do_fork(clone_flags & ~CLONE_VFORK, newsp, &regs);
 }
 
 asmlinkage int sys_vfork(struct pt_regs regs)
 {
-	int     child;
+	int child;
+	struct semaphore sem = MUTEX_LOCKED;
 
-	child = do_fork(CLONE_VM | SIGCHLD, regs.esp, &regs);
+	current->vfork_sem = &sem;
+	child = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs.esp, &regs);
 
 	if (child > 0)
-		sleep_on(&current->vfork_sleep);
+		down(&sem);
 
 	return child;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov