Current-Users archive

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

Re: Proposal: new libc/libutil functions to map SIGXXXX <-> "XXXX"

    Date:        Fri, 28 Apr 2017 11:38:38 +0000 (UTC)
    From: (Christos Zoulas)
    Message-ID:  <odv9ju$c83$>

  | Perhaps signame() -> strsignal_r()?

Uh, no, strsignal() (while it could probably do with an _r variant)
is something quite different  - it returns "emulator trap" (or something)
in a locale dependent way, where the new function returns "EMT", given
that SIGEMT is the signal number handed to both.

I'm not sure I'm competent to deal with locale using functions,
or I'd probably have suggested a thread safe version of strsignal()
as well.   (Or rather, I'm sure I'm not competent...)

However, in an off-list message (which I asked him to repeat on list,
but which has not happened yet) Kamil did indicate that the names I
picked conflict (badly for signame) with names used (presumably for
other things) in other software, so we do probably need something
different...  perhaps signal_name() and signal_number() ?

Joerg Sonnenberger <> said:

   | I'd call it signalnumber and signalname,

those names would be fine too (assuming they're not in wide use elsewhere...)

   | I'd just make it
   |     const char *signame(int sig) __pure

That would certainly simplify it a bit (but what does __pure mean?   And
if there, would that be in the man page, or just the code? (.c & .h) .. and
if in the man page, does anyone know the markup method to accomplish that?)


ps: in another off-list message, Paul Goyette sent a correction to the
man page ... that got made, I also added a little to the test prog
(but neither of those are in the ftp:// file yet) - most of the test
prog will vanish if we adopt Joerg's suggestion.

Home | Main Index | Thread Index | Old Index