[PATCH 4/4] signal: Only handle on NSIG signals on signal functions (BZ #25657)

Andreas Schwab schwab@linux-m68k.org
Tue Apr 21 15:05:41 GMT 2020


On Apr 21 2020, Adhemerval Zanella via Libc-alpha wrote:

> On 21/04/2020 11:07, Florian Weimer wrote:
>> * Adhemerval Zanella:
>> 
>>> On 21/04/2020 10:47, Florian Weimer wrote:
>>>> * Adhemerval Zanella:
>>>>
>>>>> On 21/04/2020 10:14, Florian Weimer wrote:
>>>>> Only handle __NSIG_WORDS on linux sigsetopts.h instead of _SIGSET_NWORDS
>>>>> when manipulating sigset_t masks.
>>>>
>>>> Hmm.  __NSIG_WORDS is defined like this:
>>>>
>>>>> +# define __NSIG_WORDS (_NSIG / (8 * sizeof (unsigned long int )))
>>>>
>>>> This gives us two words for _NSIG == 65.  Is this correct?
>>>
>>> Two words (32-bits) for all 64-bit architectures,
>> 
>> sizeof (unsigned long int) is 8 on 64-bit.  65 / (8 * 8) is 1.
>> 
>> I assume that for _NSIG == 65, the signal numbers from 0 to 64 are all
>> valid and can be manipulated using sigaddset etc.  This suggests to me
>> that we need three 32-bit longs and two 64-bit longs.
>
> Indeed my mistake here, I was reading the value as the required words
> the maximum accessed index.

Note that signal numbers are 1-based, and bit 0 of a signal mask is for
signal 1.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Libc-alpha mailing list