Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Dec 1997 15:40:09 -0800 (PST)
From:      Curtis Bray <cbray@best.com>
To:        freebsd-current@FreeBSD.ORG
Subject:   FreeBSD 3.0-current(12/10): rfork() problems in USERLAND?
Message-ID:  <Pine.BSF.3.96.971210144140.24991A-100000@shell5.ba.best.com>

next in thread | raw e-mail | index | archive | help
Hey Folks,

  I'm curious if anyone else if seeing this behavior with rfork... I've
cvsup'ed to the latest code as of 12/10 and I'm still having difficulties
with rfork(RFPROC | RFMEM) out in userland.  

   From past discussions my understanding was John Dyson had added the
RFMEM support into current as part of the kernel thread support for the
AIO stuff, but I'm unclear if the user process support has been finished.
Anyway, here's a dump of the program I'm running (very very basic) and
the output that occurs.  The core file was truncated when I tried to look
at it with gdb.

--------
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>


void child_proc(int procNum, int time)
{
	printf("Child %d is exiting\n", procNum);
	exit(0);
}	


void main(int argc, char *argv[])
{
	int numProc = 1;
	int procNum = 0;
	int time = 2;
	int ret, status;
	int numReturned = 0;

	if(argc > 1)
		numProc = atoi(argv[1]);

	if(argc > 2)
		time = atoi(argv[2]);

	printf("Going to create %d rfork() process\n", numProc);

	for(procNum = 0; procNum < numProc; procNum++)
	{
		if((ret = rfork(RFPROC | RFMEM)) == 0)
		{
			printf("Inside child from fork: %d\n", procNum);
			child_proc(procNum, time);
		}
		else
			printf("Parent forked %d (ret = %d)\n", procNum, ret);
	}

	printf("Parent waiting for children.\n");

	while((ret = wait(&status)) != -1)
	{
		printf("Parent woke up on wait for %d with status %d (#%d)\n", ret, status, numReturned++);
		printf("%d : Signaled? %d / %d\n", ret, WIFSIGNALED(status), WTERMSIG(status));
	}

}

-----------
program output:

Going to create 1 rfork() process
Parent forked 0 (ret = 444)
Parent waiting for children.
Parent woke up on wait for 0 with status 4231 (#0)
0 : Signaled? 1 / 7
Bus error (core dumped)

----------

  Any ideas?  Thanks in advance!
 
        Curtis





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.971210144140.24991A-100000>