:: Re: [DNG] Good thing we don't use s…
Top Page
Delete this message
Reply to this message
Author: Rainer Weikusat
Date:  
To: dng
Subject: Re: [DNG] Good thing we don't use systemd
Didier Kryn <kryn@???> writes:
> Le 06/04/2026 à 15:55, Rainer Weikusat via Dng a écrit :
>> Didier Kryn <kryn@???> writes:
>>> Le 06/04/2026 à 12:57, Rainer Weikusat via Dng a écrit :
>>>> Traditionally, the set of pending signal is bitmask, this means only one
>>>> signal of every kind can be pending at the same time. Judging from code
>>>> I read yesterday, Linux queues one non-realtime signal but this still
>>>> only makes two. Since the issue is timing dependent, some fiddling may
>>>> be necessaary to demonstrate the effect, but this program:
>>>     It is well known that signals can be missed, because of this. You
>>> can use signalfd() to serialize them, thouth I'm not sure it
>>> completely grants to not miss any.
>> The signal manpage (signal(7)) says:
>>
>> Standard signals do not queue. If multiple instances of a standard
>> signal are generated while that signal is blocked, then only one
>> instance of the signal is marked as pending (and the signal will be
>> delivered just once when it is unblocked). In the case where a
>> standard signal is already pending, the siginfo_t structure (see
>> sigaction(2)) associated with that signal is not overwritten on arrival
>> of subsequent instances of the same signal. Thus, the process will
>> receive the information associated with the first instance of the
>> signal.
>
>     With signalfd(), the kernel queues the signals into a pseudofile
> descriptor, The application normally blocks the signals it asks to
> receive by this means. It isn't specified in the man page if there can
> be a race condition in the kernel, which would allow to loose these
> signals.


This cannot possibly work in this way because otherwise, signals might
be received twice. And it obviously doesn't work in this way. The
signalfd read function just calls dequeue_signal, like anything else
which wants to receive signals.

There's also no "race condition in the kernel" which might cause signals
to be lost. Standard, that is, non-realtime signals, work just like
level-triggered interrupts. A condition is asserted and remains true
until deasserted. There's no counter which keeps track of how many times
an event which would have cause the condition to be asserted if it
hadn't already been asserted ooccured. That's how signal semantics have
been defined ever since this mechanism was invented.