diff options
Diffstat (limited to 'lib/libsystem.c')
-rw-r--r-- | lib/libsystem.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/libsystem.c b/lib/libsystem.c index 8db663bc..48c6f06d 100644 --- a/lib/libsystem.c +++ b/lib/libsystem.c @@ -13,6 +13,7 @@ Contributed to the public domain. =============================================================================*/ #define _XOPEN_SOURCE +#define _BSD_SOURCE /* Make SIGWINCH defined on OpenBSD */ #include <stdarg.h> #include <unistd.h> @@ -220,6 +221,18 @@ spawnProcessor(const char * const progName, static const char * signalName(unsigned int const signalClass) { +/* There are various signal classes that are not universally defined, + so we make a half-hearted attempt to determine whether they are and + not try to recognize the ones that aren't. We do this by testing + whether a macro is defind with the signal class name. That could give + a false negative, because the signal class name isn't necessarily + defined as a macro, but it's a really, really small problem to miss + one of these signal classes here, so we don't bother with all the work + it would take to do it right. + + OpenBSD does not have SIGWINCH and SIGIO in 2013. Everyone else seems + to have it. +*/ switch (signalClass) { case SIGHUP: /* POSIX.1 */ return "SIGHUP"; @@ -273,12 +286,6 @@ signalName(unsigned int const signalClass) { return "SIGVTALRM"; case SIGPROF: return "SIGPROF"; -/* Most systems have SIGWINCH and SIGIO, but at least OpenBSD, in 2013, - does not. Systems that do don't necessarily supply it as a macro, so - the following tests are not perfect, but a false negative is a really, - really, small problem, so we don't bother with all the work it would - take to do better. -*/ #ifdef SIGWINCH case SIGWINCH: return "SIGWINCH"; @@ -287,16 +294,14 @@ signalName(unsigned int const signalClass) { case SIGIO: return "SIGIO"; #endif +#ifdef SIGPWR + case SIGPWR: + return "SIGPWR"; +#endif case SIGSYS: return "SIGSYS"; default: return "???"; - - /* There are various other signal classes on some systems, but - not defined by POSIX and not on at least one system we - know of for which someone wanted to compile Netpbm. The - list includes: SIGPWR, SIGLOST, SIGINFO, SIGRTxx. - */ } } |