Date: Tue, 4 Jan 2000 13:36:55 -0800 From: "Scott Hess" <scott@avantgo.com> To: <freebsd-questions@freebsd.org> Subject: rfork() with RFMEM returns EOPNOTSUPP on 3.3-release. Message-ID: <068001bf56fb$d28ded80$1e80000a@avantgo.com>
next in thread | raw e-mail | index | archive | help
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 <unistd.h>
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?068001bf56fb$d28ded80$1e80000a>
