From owner-freebsd-questions Sat Mar 20 1:54:13 1999 Delivered-To: freebsd-questions@freebsd.org Received: from mailrelay.ltindia.com (unknown [202.54.20.68]) by hub.freebsd.org (Postfix) with ESMTP id 418EA14F5C for ; Sat, 20 Mar 1999 01:54:03 -0800 (PST) (envelope-from samit@usa.ltindia.com) Received: from partha.ltindia.com (usa.ltindia.com [210.146.186.131]) by mailrelay.ltindia.com (8.8.7/8.8.7) with ESMTP id PAA19890 for ; Sat, 20 Mar 1999 15:43:43 -0500 Received: from samit ([172.17.3.20]) by partha.ltindia.com (8.8.7/8.8.7) with ESMTP id PAA03693 for ; Sat, 20 Mar 1999 15:26:44 +0530 Message-ID: <36F37127.7C0B121D@usa.ltindia.com> Date: Sat, 20 Mar 1999 15:28:00 +0530 From: Samit Pal Reply-To: samit@usa.ltindia.com Organization: L&T X-Mailer: Mozilla 4.01 [en] (WinNT; I) MIME-Version: 1.0 To: FreeBSD-Questions@FreeBSD.ORG Subject: rfork() X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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