diff options
Diffstat (limited to 'config/auto-aux/signals.c')
-rw-r--r-- | config/auto-aux/signals.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/config/auto-aux/signals.c b/config/auto-aux/signals.c new file mode 100644 index 000000000..c355545d8 --- /dev/null +++ b/config/auto-aux/signals.c @@ -0,0 +1,58 @@ +/* To determine the semantics of signal handlers + (System V: signal is reset to default behavior on entrance to the handler + BSD: signal handler remains active). */ + +#include <stdio.h> +#include <signal.h> + +/* Find a signal that is ignored by default */ + +#ifdef SIGCHLD +#define IGNSIG SIGCHLD +#else +#ifdef SIGIO +#define IGNSIG SIGIO +#else +#ifdef SIGCLD +#define IGNSIG SIGCLD +#else +#ifdef SIGPWR +#define IGNSIG SIGPWR +#endif +#endif +#endif +#endif + +#ifdef IGNSIG + +int counter; + +void sig_handler(dummy) + int dummy; +{ + counter++; +} + +int main(argc, argv) + int argc; + char ** argv; +{ + signal(IGNSIG, sig_handler); + counter = 0; + kill(getpid(), IGNSIG); + kill(getpid(), IGNSIG); + return (counter == 2 ? 0 : 1); +} + +#else + +/* If no suitable signal was found, assume System V */ + +int main(argc, argv) + int argc; + char ** argv; +{ + return 1; +} + +#endif |