Execl() command not executing in child processes

mtxinu!phobos.sybase.com!coop at ucbvax.berkeley.edu mtxinu!phobos.sybase.com!coop at ucbvax.berkeley.edu
Fri Jun 16 02:16:37 AEST 1989


I've been working on a C program for use on Sun workstations (sun3/sun4)
which creates 8 child processes using vfork() [call this program Parent].
Each of these children then executes another program using the execl()
command [call this program Child].

Parent creates a file called control<n> for each execution of Child, where
<n> is the number of the forked process (i.e. there are 8 files called
control0 thru control7).  Parent writes a command to each file, and the
various executions of Child read their respective one.  Each image of
Child in turn goes to a certain point, depending on which image it is,
stops, and writes a response back to its control file.  Parent reads the
control files, sends messages back, and the Child images continue on to
another step, and so forth.  When all the children are finished, and have
communicated it to Parent, Parent cleans up and exits.

Now, there are several executions of Parent in series with different
command line args.  As long as I run them individually and manually, or
thru a shellscript, there seems to be no problems.  However, this is
eventually supposed to be ported to other machines, some of which are not
UNIX.  Therefore, I need these executions to be controlled by a driver
that we have here in house, another C program which is already portable.
For unknown reasons, when the driver is responsible for the several
executions of Parent, some of the executions of Child fail to commence
(usually one, sometimes two, of the eight).  Using some debugging, I have
concluded that the stopgap is at the execl() command.  Vfork() is
definitely working, but the child processes aren't firing off the Child
program.  The code just hangs at execl().  Parent has a safety valve in
that after a certain amount of time it just goes on whether a particular
child is communicating with it or not.  When Parent eventually exits, the
hung executions of Child suddenly continue; but of course they crash
because they're now out of sync with Parent.

This doesn't appear to be virtual memory related.  Use of fork() instead
of vfork() doesn't change the results.  I'm not familiar with the source
to the driver, but I believe it uses execl() or one of it's equivalents to
execute Parent.

Anyone have any ideas what's going on, and how I might fix or circumvent
it?

Please e-mail your responses.  I don't regularly read any of the newsgroups
to which this is posted.

Many thanks in advance,

John Cooper                               | My opinions, may not be employer's.
sybase!coop at sun.com                       |
{sun,lll-tis,pyramid,pacbell}!sybase!coop | Tell your witty quote to the world!
6475 Christie Av.  Emeryville, CA 94608   | Rent this space!  Ask for low rates.
415 596-3500                              | Call me, your rep for Rent-a-sig.



More information about the Comp.sys.sun mailing list