Subject: Re: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally

From: Bastien ROUCARIES <[email-masked]>
Date: Sat, 16 Jul 2011 10:38:24 +0200

2011/7/15 Eric Blake <[email-masked]>:
> On 07/15/2011 04:28 AM, Pádraig Brady wrote:
>> On 15/07/11 08:50, Paul Eggert wrote:
>>> On 07/14/11 17:25, Pádraig Brady wrote:
>>>> I'm not sure about defining these to 0 in gnulib.
>>>> That will silently ignore the intent of a program on certain platforms.
>
>> Absolutely. What I was getting was that it's probably better to leave
>> the following to the app too:
>>
>> #ifndef SA_RESETHAND
>> # define SA_RESETHAND 0
>> /* Now the app writer knows they need to handle this case */
>> #endif
>
> Can't the gnulib sigaction module be taught to fake SA_RESETHAND, by
> wrapping the user's signal-handler inside a gnulib shim, where the shim
> resets signals correctly before calling the user's handler?  Granted,
> it's not trivial, but I think that it is still within the realm of
> technical possibilities.  At which point, SA_RESETHAND would always be
> non-zero once you use the gnulib <signal.h>.
>
>>> On NonStop, if you invoke signal(), it uses the SA_RESETHAND semantics
>>> (POSIX allows this).  Conversely, if you invoke sigaction(), NonStop
>>> always behaves as if SA_RESTART and SA_RESETHAND are zero, i.e., it
>>> doesn't support either feature with sigaction.
>>
>> Thanks for checking that.
>
> Seems like there's some room for improvement in the gnulib sigaction
> module then.
Could help to implement pipe to self for pselect... I favor this.

Bastien