Re: Does Cygwin have str2sig/sig2str?

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On May 20 15:23, Joel Sherrill wrote:
> On Thu, May 20, 2021, 2:54 PM Corinna Vinschen <[email protected]> wrote:
> 
> > On May 20 09:58, Joel Sherrill wrote:
> > > Hi
> > >
> > > The next POSIX version is wrapping up and unless something changes will
> > be
> > > adding str2sig and sig2str. Does Cygwin have those?
> > >
> > > I'm asking to see if we adapt the Cygwin version for general use or have
> > to
> > > write it from scratch.
> > >
> > > The glibc and Illumos implementations are what you would expect. They
> > just
> >
> > I don't see glibc defining the above symbols in the master branch.
> >
> 
> Hmm ... Maybe google found someone's branch.
> 
> 
> > > use an array of { signal, string_name} and a lookup search.
> > > Something similar would be OK for newlib.
> >
> > Cygwin exports two functions with equivalent functionality:
> >
> >   char *strsignal (int signo);
> >   int strtosigno (const char *name);
> >
> > see the file winsup/cygwin/strsig.cc.
> >
> 
> I think those are the bsd equivalents.
> 
> Would it be ok to generalize that and provide the new POSIX as well as the
> BSD interfaces?

Don't ask, just do it.  Let's discuss existing patch proposals.

One problem: strsignal requires thread local storage, which isn't
generically available in newlib.  Ideally Cygwin's strsignal is
rewritten in terms of sig2str, just

- using _my_tls.locals.signamebuf as parameter and

- SIG2STR_MAX must be == sizeof ("Unknown signal 4294967295   ") for
  backward compatibility.


Thanks,
Corinna
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.