child process using execl()
Alan DuBoff
maestro@SoftOrchestra.com
Thu, 01 Jun 2000 10:49:26 -0700
Chris Waters wrote:
> One of the bay area LUG lists would probably have been a better
> choice.
Yeah, I used to use SVLUG, but there is so much garbage on the list from
people ranting about how cool they think they look in the mirror, it's enough
to make you regurgitate...:-/
> Or maybe comp.lang.c or comp.unix.programmer or something
> like that. (The FAQ for the latter is probably good to have.) I also
> recommend a good book on unix or linux programming. David Curry's
> _Unix Systems Programming_ (O'Reilly) or Johnson & Troan's _Linux
> Application Development_ (Addison Wesley) are among the ones I own.
I'll have to check out those books for future use. I've done a lot of system
programming on other platforms, but not on Linux. I think I've seen the later
mentioned above, possibly a large hardcover book.
> You might also want to study the source of the many programs you
> already have. (One of the reasons it's so nice to have source.)
Yeah, I realized that after I sent that last night I would probably be best
off pulling the source for the c library and taking a gander at execl().
> See the system(3) and wait(2) man pages. It sounds like you're trying
> to reinvent the former, but if not (if you're trying to do something
> more complex), then you probably need the latter.
Hmmmm...I guess that could be a problem, but I am checking the pid to see if
it's 0, at which point I've got the child.
> No. That's system(3) (which doesn't need fork). With exec, to avoid
> zombie processes, you have to either call wait(2) to reap the dead
> children or trap SIGCHLD (and the latter can be unreliable). Or you
> can get really fancy with process groups, but that's non-trivial.
I know there is a waitpid() call, are you saying to wait for the children to
die by using something similar?
I'm trying to avoid system(), I had some of those in that were giving me
problems. I'm using the msgctl, msgsnd, msgrcv functions for IPC between the
parent and child, that seems to work ok...
Let me look into the wait stuff.
Thanks for the reply Chris!
--
Alan DuBoff
Software Orchestration, Inc.