From owner-p4-projects@FreeBSD.ORG Sat Sep 23 08:55:18 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0FBAC16A412; Sat, 23 Sep 2006 08:55:18 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CC28716A407 for ; Sat, 23 Sep 2006 08:55:17 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5A4D043D45 for ; Sat, 23 Sep 2006 08:55:17 +0000 (GMT) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k8N8tHAJ039667 for ; Sat, 23 Sep 2006 08:55:17 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k8N8tGjF039664 for perforce@freebsd.org; Sat, 23 Sep 2006 08:55:16 GMT (envelope-from rdivacky@FreeBSD.org) Date: Sat, 23 Sep 2006 08:55:16 GMT Message-Id: <200609230855.k8N8tGjF039664@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rdivacky@FreeBSD.org using -f From: Roman Divacky To: Perforce Change Reviews Cc: Subject: PERFORCE change 106538 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Sep 2006 08:55:18 -0000 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); }