[RFC] Consider adding a function to convert error name to errno

Rocket Ma marocketbd@gmail.com
Wed May 27 15:57:41 GMT 2026


> For this I think the straightforward solution would keep a separate alias
> table (name -> number) for both canonical and alias variants. Check
> "IOT" in the alias table, find SIGABRT, then resolve to the canonical
> abbreviation if needed.
>
> I am assuming the alias table will be small, so we can just make a linear
> search all the time.
>
> Another possibility would to extend __sys_sigabbrev to store the aliases
> as well. But this is consume more memory, but be straightforward.
>
> I would check the the alias first.

The `kill` from `util-linux `lists probably all signal names.[1] The
source code should be helpful.

[1]: https://github.com/util-linux/util-linux/blob/master/lib/signames.c#L22

> My understanding is sig2str should return -1 for 32 (SIGCANCEL) and
> 33 (SIGSETXID), even though these value are not handling as EINVAL
> for kill().  My understanding is POSIX code should only issues kill()
> with the values from signal.h, including RTMIN ones; and SIGCANCEL
> and SIGSETXID are an implementation detail.

Got it.


More information about the Libc-alpha mailing list