monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] auto updates


From: Nuno Lucas
Subject: Re: [Monotone-devel] auto updates
Date: Sun, 29 Oct 2006 09:13:15 +0000

On 10/29/06, Zack Weinberg <address@hidden> wrote:
On 10/29/06, Nathaniel Smith <address@hidden> wrote:
>
> It should be possible to deal with zombies through some POSIX hackery,
> no?  The only tricky bit is that we _do_ sometimes want to wait for a
> process, so we can't just unconditionally get rid of zombies...

Fork a child, which forks a grandchild and exits.  Grandchild execs
what you really wanted to run.  wait() returns for the child, and the
grandchild gets reparented to init.

This seems a bit of a hack when a simple solution is easy.

Just do this for POSIX systems (I don't believe there is a problem
with zombie processes on other systems):

static void signal_handler( int sig, siginfo_t* si, void * context )
{
  int status;
  wait (&status);
}

main( ... )
{
   struct sigaction sigact;
   memset( &sigact, 0, sizeof(sigact) );
   sigact.sa_sigaction = &signal_handler;
   sigact.sa_flags     = SA_SIGINFO;
   sigaction( SIGCHLD, &sigact, NULL );
  ...
}


Regards,
~Nuno Lucas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]