bakken@cs.arizona.edu (Dave Bakken) (06/13/90)
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