From owner-freebsd-hackers Sat Mar 20 20: 5:22 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from pluto.ipass.net (pluto.ipass.net [198.79.53.5]) by hub.freebsd.org (Postfix) with ESMTP id 5E5E214C92; Sat, 20 Mar 1999 20:05:13 -0800 (PST) (envelope-from mmercer@ipass.net) Received: from ipass.net (ts4-11-ppp.ipass.net [207.120.205.11]) by pluto.ipass.net (8.9.1a/8.9.1) with ESMTP id XAA28893; Sat, 20 Mar 1999 23:04:50 -0500 (EST) Message-ID: <36F4707E.E7A6D897@ipass.net> Date: Sat, 20 Mar 1999 23:07:27 -0500 From: "Michael E. Mercer" Reply-To: samit@usa.ltindia.com X-Mailer: Mozilla 4.5 [en] (X11; U; FreeBSD 4.0-CURRENT i386) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-current@freebsd.org Cc: freebsd-hackers@freebsd.org Subject: rfork() Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello, This was posted to freebsd-questions with no reply. I tried this and the child process created a core file. I also tried the other options and they seem to work. Just RFPROC and RFMEM DON'T! Thanks, Michael Mercer -------------------- 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. Code: #include 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); } } Output: $ cc test.c $ a.out & $ Parent Process start Parent process continues with childId(10759) Samit,PID(10758) ps PID TT STAT TIME COMMAND 10697 p2 Ss 0:00.07 -sh (sh) 10758 p2 S 0:00.00 a.out 10759 p2 Z 0:00.00 (a.out) 10760 p2 R+ 0:00.00 ps why it is created zombie and it does not execute the code ? --Samit. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message