From owner-freebsd-questions Tue Jan 4 13:37:53 2000 Delivered-To: freebsd-questions@freebsd.org Received: from bomber.avantgo.com (ws1.avantgo.com [207.214.200.194]) by hub.freebsd.org (Postfix) with ESMTP id B0D2714E60 for ; Tue, 4 Jan 2000 13:37:50 -0800 (PST) (envelope-from scott@avantgo.com) Received: from river ([10.0.128.30]) by bomber.avantgo.com (Netscape Messaging Server 3.5) with SMTP id 185 for ; Tue, 4 Jan 2000 13:33:34 -0800 Message-ID: <068001bf56fb$d28ded80$1e80000a@avantgo.com> From: "Scott Hess" To: Subject: rfork() with RFMEM returns EOPNOTSUPP on 3.3-release. Date: Tue, 4 Jan 2000 13:36:55 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2314.1300 X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I'm having a bizarre problem. From the rfork man page, it appears that I should be able to call rfork( RFPROC|RFMEM) to get a new process which shares the current process' virtual memory. Instead, I get a -1 return with errno==EOPNOTSUPP. The following snippet works fine when compiled with 'cc -o rfork rfork.c', but doesn't work when compiled with 'cc -o rfork -DSHAREMEM rfork.c'. Everything looks right, anyone know what I'm missing? Thanks, scott The snippet: #include void main( void) { int cpid; printf( "In parent\n"); #ifdef SHAREMEM cpid=rfork( RFPROC|RFMEM); #else cpid=rfork( RFPROC); #endif if( cpid==-1) { perror( "rfork"); } else if( cpid==0) { printf( "In child cpid==%d and pid==%d\n", cpid, getpid()); sleep( 1); printf( "Child exitting\n"); } else { printf( "In parent cpid==%d and pid==%d\n", cpid, getpid()); sleep( 2); printf( "Parent exitting\n"); } } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message