🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.sequent
1 messages
1 total messages Started by Dave Bakken Wed, 13 Jun 1990 04:39
vfork & execl from an m_fork child
#275
Author: Dave Bakken
Date: Wed, 13 Jun 1990 04:39
46 lines
2355 bytes
I am trying to do a vfork and then execl from a child
proces that was created with m_fork, but the child
never arrives at the execl'd process.  This happens
in a (stable) runtime system I am parallelizing.  Of
course, when I whip up a little toy program to
show this, it works fine.  However, I don't see what
I could possibly do to goof up execl, and I am
wondering if there are any known bugs or features
associated with this situation.  Any help,  hints or
caveats would be greatly appreciated.  I've enclosed a
code fragment below to show exactly what is going on.
Thanks!

Dave Bakken			Internet: bakken@cs.arizona.edu	
Dept. of Comp. Sci.; U.of Ariz. UUCP:     uunet!arizona!bakken
Tucson, AZ 85721		Bitnet:   bakken%cs.arizona.edu@Arizrvax
AT&T:     +1 602 621 4098	FAX:	  +1 602 621 4246

    if (pipe (fd) != 0)		/* make pipe for initial message from srx */
	sr_abort ("can't open pipe for srx");
    if ((pid = fork ()) < 0)
	sr_abort ("can't vfork to start srx");
    if (pid == 0) {

	/* we're the child - execute srx */
	dup2 (fd[1], 0);  /* make pipe output fd 0 for srx, replacing stdin */

	DEBUG(mask,"child right before execl to %s",path,0,0);

	execl (path, path, VM_MAGIC, PROTO_VER, sr_argv[0], NULL);

	perror (path);
	abort ("can't execute srx");
    }
    DEBUG(mask,"parent after vfork",0,0,0);

Here, the child prints out its message inside the if (pid == 0) branch,
and the execl'd program never runs.  The parent prints out the message
if and only if set_num_procs(n) was called with n==1 (I've tried
n=1 with a bunch of different random seeds, and it works out the
same each time).  ps shows only one process with n==1.  
-- 
Dave Bakken			Internet: bakken@cs.arizona.edu	
Dept. of Comp. Sci.; U.of Ariz. UUCP:     uunet!arizona!bakken
Tucson, AZ 85721		Bitnet:   bakken%cs.arizona.edu@Arizrvax
AT&T:     +1 602 621 4098	FAX:	  +1 602 621 4246
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads