child process using execl()

Alan DuBoff maestro@SoftOrchestra.com
Wed, 31 May 2000 22:39:50 -0700


I'm not sure if this is appropriate to ask here, but I'll throw it out
anyway...

I'm forking off a child process (using fork()) and executing an application
with execl().

The gcc docs don't seem completely clear on this issue, but if understand from
reading:

http://www.gnu.org/manual/glibc-2.0.6/html_chapter/libc_23.html

At the bottom of the page it would appear that if there is an error in calling
execl(), it will return an error, and which point it uses _exit() in their
example. If it is successful, it doesn't return. But my question is, if I use
execl() and it is successful, will it return at a later point if the child seg
faults, or gets killed?

Specifically, I'm wondering if I have a child process fork'd off and it does
get killed or terminated, will it return to the calling routine on the line
after execl(), or if it just dies and I get a notification in my sig handler?
I wasn't sure if linux actually replaces the return address or not on success
of execl(), so that a successful call to execl() wouldn't return to the parent
process at all.

I have my fork() working and I'm able to execl() my app from within, but I
want to be able to kill my child off and fork() it again. When I do that I get
some strangeness happen until I eventually hang linux (after I fork and execl
about 10 processes).

When I look at processes, I see them hanging around, after I kill them, but
often in a state of 'D' (uninterruptible sleep), and that doesn't make sense
to me, as I've received a SIGTERM signal to my sig handler. Seems they should
be gone...

-- 

Alan DuBoff
Software Orchestration, Inc.