[2019-02-02 20:54] Philipp Takacs <phil...@bureaucracy.de>
> [2019-02-02 10:26] Dmitry Bogatov <kact...@debian.org>
> >   * sbr/pidstatus.c(pidstatus): signum variable, returned by WTERMSIG macro
> >     is always positive.
>
> The problem is WTERMSIG don't promise this. So if a bad implementation
> return a negative number we have undefined behavior. The test is not
> expensive. So I would like to keep this test.

POSIX promises. Look:

        WTERMSIG
            Return signal number that caused process to terminate.

which, is positive number:

        The <signal.h> header shall define the following macros that are used to
        refer to the signals that occur in the system. Signals defined here
        begin with the letters SIG followed by an uppercase letter. The macros
        shall expand to positive integer constant expressions with type int and
                        ^^^^^^^^
        distinct values. The value 0 is reserved for use as the null signal (see
        kill()). Additional implementation-defined signals may occur in the
        system.

And I question not perfomance, but code complexity and hackability.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_wait.h.html
-- 
        Note, that I send and fetch email in batch, once every 24 hours.
                 If matter is urgent, try https://t.me/kaction
                                                                             --

Reply via email to