Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240804160244.16aaa35b@eclair>
Date: Sun, 4 Aug 2024 16:02:44 +0200
From: Joakim Sindholt <opensource@...sha.com>
To: musl@...ts.openwall.com
Subject: Re: [PATCH 2/2] signal: add str2sig(3) from POSIX.1-2024

On Sun, 4 Aug 2024 14:39:21 +0100 Pedro Falcato <pedro.falcato@...il.com> wrote:
> To me it looks like the best way to implement these two functions is
> to create a table of some sorts (indexed by signal, so array[SIGINT] =
> "INT") and then use it.
> str2sig would just iterate the whole array with strcmps, which is a
> _little_ slow but this is probably not performance critical anyway.
> 
> Special casing would be required for RT signals, but that's no biggie.
> What do you think?

I was thinking the same thing for the sake of size.
There are a few more special cases though as some signal names refer to the
same signal numbers.

View attachment "sig2str.c" of type "text/x-c++src" (2720 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.