diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-07-09 02:23:16 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-07-09 02:23:16 -0400 |
commit | c90fa2ace73851d6af4946c239c90db91cad8abe (patch) | |
tree | 50322e9ed08e351a6ae31cd55af1d305e2615ad8 | |
parent | 8599822ee1d70a1e42e1d4b4962bc1d0bdf7e5ab (diff) | |
download | musl-c90fa2ace73851d6af4946c239c90db91cad8abe.tar.gz musl-c90fa2ace73851d6af4946c239c90db91cad8abe.tar.bz2 musl-c90fa2ace73851d6af4946c239c90db91cad8abe.tar.xz musl-c90fa2ace73851d6af4946c239c90db91cad8abe.zip |
add realtime signals to strsignal
the name format RTnn/RTnnn was chosen to minimized bloat while
uniquely identifying the signal.
-rw-r--r-- | src/string/strsignal.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/string/strsignal.c b/src/string/strsignal.c index d70982aa..f0c3db7a 100644 --- a/src/string/strsignal.c +++ b/src/string/strsignal.c @@ -48,7 +48,7 @@ static const char map[] = { [SIGSYS] = 31 }; -#define sigmap(x) ((unsigned)(x) >= sizeof map ? 0 : map[(unsigned)(x)]) +#define sigmap(x) ((x) >= sizeof map ? (x) : map[(x)]) #endif @@ -84,14 +84,30 @@ static const char strings[] = "Window changed\0" "I/O possible\0" "Power failure\0" - "Bad system call"; + "Bad system call\0" + "RT32" + "\0RT33\0RT34\0RT35\0RT36\0RT37\0RT38\0RT39\0RT40" + "\0RT41\0RT42\0RT43\0RT44\0RT45\0RT46\0RT47\0RT48" + "\0RT49\0RT50\0RT51\0RT52\0RT53\0RT54\0RT55\0RT56" + "\0RT57\0RT58\0RT59\0RT60\0RT61\0RT62\0RT63\0RT64" +#if _NSIG > 65 + "\0RT65\0RT66\0RT67\0RT68\0RT69\0RT70\0RT71\0RT72" + "\0RT73\0RT74\0RT75\0RT76\0RT77\0RT78\0RT79\0RT80" + "\0RT81\0RT82\0RT83\0RT84\0RT85\0RT86\0RT87\0RT88" + "\0RT89\0RT90\0RT91\0RT92\0RT93\0RT94\0RT95\0RT96" + "\0RT97\0RT98\0RT99\0RT100\0RT101\0RT102\0RT103\0RT104" + "\0RT105\0RT106\0RT107\0RT108\0RT109\0RT110\0RT111\0RT112" + "\0RT113\0RT114\0RT115\0RT116\0RT117\0RT118\0RT119\0RT120" + "\0RT121\0RT122\0RT123\0RT124\0RT125\0RT126\0RT127\0RT128" +#endif + ""; char *strsignal(int signum) { char *s = (char *)strings; signum = sigmap(signum); - if ((unsigned)signum - 1 > 31) signum = 0; + if (signum - 1U >= _NSIG-1) signum = 0; for (; signum--; s++) for (; *s; s++); |