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 14:39:00 +0000 (UTC)
    From:        christos%astron.com@localhost (Christos Zoulas)
    Message-ID:  <odvk64$ub0$1%blaine.gmane.org@localhost>

  | Well, I am sure that whatever we pick that is reasonable at this point
  | will bound to conflict with something else so I prefer to pick the
  | best names for the job instead :-)

Agreed, but if we can avoid conflicting with *everything* that would be
better (provided the name picked is reasonable) - it is not as if there
aren't multiple possible choices.

  | >Joerg Sonnenberger <jjoerg%bec.de@localhost> said:
  | >   | I'd call it signalnumber and signalname,
  | 
  | sure, those work too.

For now, let's assume those will be what we use...

  | Pure means that it will return the same value given the same argument,

OK, thanks...  (Somewhere I kind of knew that...)

  | I am not sure about making it pure though; how about if you pass a signal
  | number that does not exist? Should it return "Unknown signal", or
  | "Unknown signal %d".

No, none of those, people who want that kind of output waht strsignal()
instead.   The return value is just something like "EMT" or "HUP", the
only reasonable return value for an error here is "nothing" (ie: NULL).

The version I proposed returned 0, and left the name buffer unchanged in
this case, but using Joerg's suggestion (which I am liking more and more)
it would just be a NULL return.   Then if the application happens to
want "Unknown signal %d" it can just *printf("Unknown signal %d", ...);

Now the next question is just what goes in the man page, for that __pure
stuff, and if it goes there, how to produce that using -mdoc

kre



Home | Main Index | Thread Index | Old Index