From owner-freebsd-hackers Tue Jan 11 21:37:31 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp01.mrf.mail.rcn.net (smtp01.mrf.mail.rcn.net [207.172.4.60]) by hub.freebsd.org (Postfix) with ESMTP id 8247614F2D for ; Tue, 11 Jan 2000 21:37:28 -0800 (PST) (envelope-from archer@lucky.net) Received: from 207-172-82-4.s4.as7.xnb.nj.dialup.rcn.com ([207.172.82.4] helo=unknown.nowhere.org) by smtp01.mrf.mail.rcn.net with esmtp (Exim 2.12 #3) id 128GTG-0005P6-00; Wed, 12 Jan 2000 00:37:26 -0500 Received: (from archer@localhost) by unknown.nowhere.org (8.9.3/8.9.3) id AAA10170; Wed, 12 Jan 2000 00:34:53 -0500 (EST) (envelope-from archer) Date: Wed, 12 Jan 2000 00:34:53 -0500 (EST) Message-Id: <200001120534.AAA10170@unknown.nowhere.org> From: Alexander Litvin To: "Scott Hess" Cc: hackers@freebsd.org Subject: Re: rfork() [was: Concept check] X-Newsgroups: unknown.freebsd.hackers In-Reply-To: <1d5c01bf5c42$1409d990$1e80000a@avantgo.com> User-Agent: tin/1.4-19991113 ("No Labels") (UNIX) (FreeBSD/4.0-CURRENT (i386)) Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In article <1d5c01bf5c42$1409d990$1e80000a@avantgo.com> you wrote: > You've got that backwards - fork() and vfork() can easily be implemented in > terms of rfork() [in fact, I believe all three are implemented in terms of > fork1() in the kernel]. rfork(RFMEM) means that the processes share all > memory - current AND FUTURE. You could use minherit() before fork() to > share current memory, but not future memory. BTW, concerning rfork(RFMEM). Could somebody explain me, why the following simple program is coredumping: #include #include volatile int data=0; int main() { volatile int pid=0; int status; pid=rfork(RFPROC|RFMEM|RFCFDG); if(pid==-1) { perror("rfork"); exit(-1); } if(pid!=0) { wait(&status); printf("Data is %d\n",data); } else data=1; } --- The world is coming to an end. Please log off. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message