On 12 March 2008, Hannah Schroeter <[EMAIL PROTECTED]> wrote:
> Hi!
>
> On Wed, Mar 12, 2008 at 12:05:29PM +0200, Liviu Daia wrote:
> >On 12 March 2008, Lars NoodC)n <[EMAIL PROTECTED]> wrote:
> >[...]
> >> And, is there a generic way to prevent them?  The cause is a perl
> >> CGI called by apache2
>
> >    Depending on what you're doing, make the parent wait(2) for the
> >processes or setsid(3).
>
> setsid(2) (yes, it's section 2 on OpenBSD)

    Yes, sorry.

> doesn't make the child lose the connection to the parent.

    No, it actually makes the calling process a session leader.

> See the source of daemon(3) for how to use setsid in connection with
> fork and exit (in fact _exit) to make a process "disconnect" from its
> parent and its controlling terminal etc.

    Actually, there's a bunch of other things to take care of, like
signals and pipes.  A more complete answer would be something like:
"read a book about UNIX process management"; I was trying to provide a
hint in the right direction, not abstract a book in a sentence. :)

    Regards,

    Liviu Daia

-- 
Dr. Liviu Daia                                  http://www.imar.ro/~daia

Reply via email to