Process control query (fork/exec) for BSD 4.2

Brett Galloway brett at wjvax.UUCP
Sat Jan 18 04:04:54 AEST 1986


I am working on a program which must be able to fork and execvp an arbitrary
relative path name (as in popen(3)).  My question is whether there is any
reliable for the parent to tell if the exec() in the forked child succeeded or
failed.  I tried doing a kill(pid,0) in the parent immediately after the fork
(assuming that the fork succeeded), but that produces false negative results
when the child executed very quickly.  It might also produce false positive
results if the parent gets to the kill(pid,0) before the child gets to the
exec, although since I am using vfork() that has not happened to me.

I would be interested to know how popen(), and how the shells (sh and csh)
determine the success or failure of their exec()'s.  Note that I cannot
merely use an access(2) call on the pathname, since I am using execvp()
to find relative paths.

Thanks in advance.

Brett Galloway

-------------
Brett Galloway
{pesnta,twg,ios,qubix,turtlevax,tymix,vecpyr,certes,isi}!wjvax!brett



More information about the Comp.unix.wizards mailing list