httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Hess" <sc...@avantgo.com>
Subject Re: small contrib
Date Mon, 26 Jul 1999 16:06:10 GMT
Do you ever do a variant of wait(2) to reap the children?  You can register
to handle SIGCHLD, and do a wait() in the signal handler, though it's
probably safer to set a flag in the signal handler, and on flag do the
wait() in the main loop somewhere.

A trick people sometimes use is code something like:

cpid=fork();
if( cpid==0) {
    cpid=fork();
    if( cpid==0) {
        /* execute the target process. */
        exec(...);
    }
    exit( 0);
} else if( cpid>0) {
    /* wait for the child exit */
    waitpid( cpid, ...);
}


>From here on, the grandchild should be able to exit and automatically be
reaped.  Of course, now you can't wait() for the grandchild or otherwise
monitor it's status easily...

Later,
scott

----- Original Message -----
From: Tom Vogt <tv@wlwonline.de>
To: <new-httpd@apache.org>
Sent: Monday, July 26, 1999 1:09 AM
Subject: Re: small contrib


> Randy Terbush wrote:
> > Also, want to get fancy? Write a pid file and trap SIGUSR1 to tell it
> > when to perform the rotation.
>
> talking about signals - I seem to have a bug in logbox.c - the gzip
> processes don't exit correctly. they remain as zombies. ugly. anyone an
> idea of what I'm doing wrong?


Mime
View raw message