🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sequent
Article #275

vfork & execl from an m_fork child

#275
From: 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
Technical Details
Message-ID: <22070@megaron.cs.arizona.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!asuvax!noao!arizona!bakken

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!asuvax!noao!arizona!bakken
From: bakken@cs.arizona.edu (Dave Bakken)
Newsgroups: comp.sys.sequent
Subject: vfork & execl from an m_fork child
Summary: execl never gets there
Keywords: hangs, vfork, fork, exec, execl, bug, feature
Message-ID: <22070@megaron.cs.arizona.edu>
Date: 13 Jun 90 04:39:22 GMT
Organization: U of Arizona CS Dept, Tucson
Lines: 46