Date: Wed, 12 Jan 2000 00:34:53 -0500 (EST) From: Alexander Litvin <archer@lucky.net> To: "Scott Hess" <scott@avantgo.com> Cc: hackers@freebsd.org Subject: Re: rfork() [was: Concept check] Message-ID: <200001120534.AAA10170@unknown.nowhere.org> In-Reply-To: <1d5c01bf5c42$1409d990$1e80000a@avantgo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <stdio.h> #include <unistd.h> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001120534.AAA10170>