Date: Sat, 27 Mar 1999 16:11:59 +1000 From: Greg Black <gjb@comkey.com.au> To: samit@usa.ltindia.com Cc: FreeBSD-Questions@FreeBSD.ORG Subject: Re: rfork() Message-ID: <19990327061159.8080.qmail@alpha.comkey.com.au> In-Reply-To: <36F37127.7C0B121D@usa.ltindia.com> of Sat, 20 Mar 1999 15:28:00 %2B0530 References: <36F37127.7C0B121D@usa.ltindia.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> Can any one suggest how to use rfork( RFPROC | RFMEM );
> according to the manual, freeBSD supports this and it should create a
> new process which will share the address space.
> But what I'm getting is
> a) It returns only to the parent process with a childID.
> b) It doesn't go into child part
> c) 'PS' shows that a child process is active.
>
> #include <unistd.h>
> main()
> {
> int childId;
> printf("Parent Process start \n");
> if ( (childId = rfork(RFMEM | RFPROC) ) == 0 ) {
> printf("In Child childId(%d) PId(%d)\n",
> childId,getpid() );
> sleep(4);
> exit(0);
> }
> {
> char buf[10] = "Samit";
> int nRet;
> printf("Parent process continues with childId(%d)
> %s,PID(%d)\n",
> childId, buf,getpid());
> sleep(5);
> }
> }
I just compiled this code on a 2.2.8-release system and both
processes produced the expected output. What version of FreeBSD
were you using?
--
Greg Black <gjb@acm.org>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990327061159.8080.qmail>
