public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* Does Cygwin have str2sig/sig2str?
@ 2021-05-20 14:58 Joel Sherrill
  2021-05-20 19:54 ` Corinna Vinschen
  0 siblings, 1 reply; 5+ messages in thread
From: Joel Sherrill @ 2021-05-20 14:58 UTC (permalink / raw)
  To: Newlib, Matthew Joyce

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
use an array of { signal, string_name} and a lookup search.
Something similar would be OK for newlib.

Thanks.

--joel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does Cygwin have str2sig/sig2str?
  2021-05-20 14:58 Does Cygwin have str2sig/sig2str? Joel Sherrill
@ 2021-05-20 19:54 ` Corinna Vinschen
  2021-05-20 20:23   ` Joel Sherrill
  0 siblings, 1 reply; 5+ messages in thread
From: Corinna Vinschen @ 2021-05-20 19:54 UTC (permalink / raw)
  To: newlib

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.

> 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.


HTH,
Corinna


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does Cygwin have str2sig/sig2str?
  2021-05-20 19:54 ` Corinna Vinschen
@ 2021-05-20 20:23   ` Joel Sherrill
  2021-05-25 13:11     ` Corinna Vinschen
  2021-06-16 17:01     ` Brian Inglis
  0 siblings, 2 replies; 5+ messages in thread
From: Joel Sherrill @ 2021-05-20 20:23 UTC (permalink / raw)
  To: Newlib

On Thu, May 20, 2021, 2:54 PM Corinna Vinschen <vinschen@redhat.com> 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?

Thanks.

--joel

>
>
> HTH,
> Corinna
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does Cygwin have str2sig/sig2str?
  2021-05-20 20:23   ` Joel Sherrill
@ 2021-05-25 13:11     ` Corinna Vinschen
  2021-06-16 17:01     ` Brian Inglis
  1 sibling, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2021-05-25 13:11 UTC (permalink / raw)
  To: Joel Sherrill; +Cc: Newlib

On May 20 15:23, Joel Sherrill wrote:
> On Thu, May 20, 2021, 2:54 PM Corinna Vinschen <vinschen@redhat.com> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does Cygwin have str2sig/sig2str?
  2021-05-20 20:23   ` Joel Sherrill
  2021-05-25 13:11     ` Corinna Vinschen
@ 2021-06-16 17:01     ` Brian Inglis
  1 sibling, 0 replies; 5+ messages in thread
From: Brian Inglis @ 2021-06-16 17:01 UTC (permalink / raw)
  To: newlib

On 2021-05-20 14:23, Joel Sherrill wrote:
> On Thu, May 20, 2021, 2:54 PM Corinna Vinschen wrote:
>> On May 20 09:58, Joel Sherrill wrote:
>>> 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 use an array of { signal, string_name} and a lookup
>>> search.  Something similar would be OK for newlib.

>> I don't see glibc defining the above symbols in the master branch.

> Hmm ... Maybe google found someone's branch.

>> 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.

Functions strsignal, psignal, and psiginfo are related current POSIX 
interfaces: there are POSIX man pages for all three, and newlib man 
pages for strsignal, psignal, but none for psiginfo, and no Cygwin man 
pages for psiginfo or strtosigno, although the latter is declared in 
string.h with strsignal, and psiginfo is declared in cygwin/signal.h; 
Cygwin also exports sys_siglist, which is no longer exported by glibc.

> Would it be ok to generalize that and provide the new POSIX as well
> as the BSD interfaces?
See the POSIX proposal notes from kre for BSD interfaces which are 
different: signalname, signalnumber, signalnext

	https://www.austingroupbugs.net/view.php?id=1138

also notes on avoiding manifest constants and using sysconf interfaces, 
which may or may not affect the final specification.

It also notes glibc added sigabbrev_np; glibc also added sigdescr_np, 
(and spurious mentions of sigdabbrev_np, which appears to be a thinko) 
and stopped exporting sys_siglist.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-16 17:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 14:58 Does Cygwin have str2sig/sig2str? Joel Sherrill
2021-05-20 19:54 ` Corinna Vinschen
2021-05-20 20:23   ` Joel Sherrill
2021-05-25 13:11     ` Corinna Vinschen
2021-06-16 17:01     ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).