bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] Add timeout utility


From: Pádraig Brady
Subject: Re: [PATCH] Add timeout utility
Date: Wed, 2 Apr 2008 10:27:11 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Mike Frysinger wrote:
> On Tuesday 01 April 2008, Pádraig Brady wrote:
>> +  /* Setup handlers before fork() so that we
>> +   * handle any signals caused by child, without races.  */
>> +  signal (SIGALRM, cleanup);    /* our timeout.  */
>> +  signal (SIGINT, cleanup);     /* Ctrl-C at terminal for example.  */
>> +  signal (SIGQUIT, cleanup);    /* Ctrl-\ at terminal for example.  */
>> +  signal (SIGTERM, cleanup);    /* if we're killed, stop monitored
>> process.  */ +  signal (SIGHUP, cleanup);     /* terminal closed for
>> example.  */ +  signal (SIGTTIN, SIG_IGN);    /* don't sTop if background
>> child needs tty.  */ +  signal (SIGTTOU, SIG_IGN);    /* don't sTop if
>> background child needs tty.  */
> 
> if you're using signal(), you have race problems.  why not use sigaction() 
> and 
> friends instead ?

I originally wrote this for util-linux-ng.
BSD and linux at least handle signal() sanely
so I wrote it for those.

Since coreutils needs to be more portable,
I'll change to the more complicated sigaction instead.

To be sure, are you referring to races where a signal
can be received while in the signal handler on some systems?

Also there is the issue of restarting system calls
after the signal handler has run.

Also there is the issue of resetting the signal
handler after it has run.

Are there systems that coreutils supports currently
that doesn't follow BSD/linux semantics wrt the above 3 points?

thanks,
Pádraig.




reply via email to

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