A NOTE has been added to this issue. 
====================================================================== 
http://austingroupbugs.net/view.php?id=1138 
====================================================================== 
Reported By:                joerg
Assigned To:                
====================================================================== 
Project:                    1003.1(2016)/Issue7+TC2
Issue ID:                   1138
Category:                   System Interfaces
Type:                       Enhancement Request
Severity:                   Editorial
Priority:                   normal
Status:                     New
Name:                       Jörg Schilling 
Organization:                
User Reference:              
Section:                    System Interfaces 
Page Number:                new interface 
Line Number:                newinterface 
Interp Status:              --- 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2017-04-27 12:02 UTC
Last Modified:              2017-04-28 02:14 UTC
====================================================================== 
Summary:                    Add strsignal(), sig2str() and str2sig() to the
standard.
====================================================================== 

---------------------------------------------------------------------- 
 (0003683) kre (reporter) - 2017-04-28 02:14
 http://austingroupbugs.net/view.php?id=1138#c3683 
---------------------------------------------------------------------- 
I have just proposed adding, to NetBSD, functions as described in the
man page I am including in this note.   If there is ever a desire to add
functions for this purpose to POSIX, please consider these as alternatives
to str2sig() and sig2str() as included above (I am not requesting that
they
actually be included, just that I believe these are better than those...)

Complete source (such as it is - quite *BSD dependent, as they use
sys_signame
as described by Jilles in note 3682) is available (for a time anyway) from
    ftp://munnari.oz.au/kre/signame.tgz
(files unpack into the current directory, a test program can be built, on
BSD systems anyway, by "cc *.c" - there is no Makefile.)

Note at the end where it says "First appeared in NetBSD 8.0" - 8.0 has
not been released yet (getting closer, but still some way away) - as of
the date of this note, this is still just a proposal, no guarantee that
they
will appear, if they do, that they are added to libc, or that the names or
interfaces will not be changed.

kre

SIGNAME(3)                 Library Functions Manual                
SIGNAME(3)

NAME
     signame signumber -- convert between signal numbers and names

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <signal.h>

     int
     signame(int sig, char *name, size_t namelen);

     int
     signumber(const char *name);


DESCRIPTION
     The signame() function takes a signal number sig, places the name of
that
     signal in the buffer given by name (which contains namelen bytes) or
as
     much of the signal name as will fit in that buffer, and still allow it
to
     be nul (`\0') terminated.  Signal names returned do not contain a
leading
     ``SIG'' prefix.

     The return value of signame() is zero (0) if sig does not represent a
     valid signal number, otherwise it is the length of the name of the
signal
     corresponding to that number.  Note: this can be longer than namelen,
     which allows applications to determine whether the buffer provided
was
     large enough.  If the return value is greater than 0, and less than
     namelen then the complete signal name has been returned in name.
     Otherise if the return value is namelen or larger, a truncated name
has
     been returned.  If the return value is 0, sig was not a valid signal
     number, and the buffer at name is unchanged.

     The signumber() function converts the signal name name to the number
     corresponding to that signal.  Any leading ``SIG'' prefix in name is
     ignored.  The name is compared in a case independent manner.  The
     signumber() function returns the signal number, or zero (0) if the
name
     given does not represent a valid signal.

     The file <signal.h> defines the constant MAX_SIG_NAME_LEN which may
be
     used by applications to size the buffer for use by the signame()
     function.  However, applications should be aware that this information
is
     valid only in relation to the particular system upon which, and at
the
     particular time at which, compilation is performed.  When signame()
is
     actually invoked, signals with longer names may exist.  signame() may
be
     invoked with a namelen of zero (0) to determine the size of the
buffer
     actually required to hold the nul-terminated name of signal sig.  In
this
     case the name parameter is not used, and may be NULL.

SEE ALSO
     intro(2), psignal(3), strsignal(3)

HISTORY
     The signame() and signumber() functions first appeared in NetBSD 8.0. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2017-04-27 12:02 joerg          New Issue                                    
2017-04-27 12:02 joerg          Name                      => Jörg Schilling 
2017-04-27 12:02 joerg          Section                   => System Interfaces
2017-04-27 12:02 joerg          Page Number               => new interface   
2017-04-27 12:02 joerg          Line Number               => newinterface    
2017-04-27 12:11 joerg          Note Added: 0003678                          
2017-04-27 13:32 schwarze       Note Added: 0003679                          
2017-04-27 14:15 joerg          Note Added: 0003680                          
2017-04-27 15:47 kre            Note Added: 0003681                          
2017-04-27 16:30 jilles         Note Added: 0003682                          
2017-04-28 02:14 kre            Note Added: 0003683                          
======================================================================


Reply via email to