From b0de699679e8f1e39af847ed172d1ba605b4370c Mon Sep 17 00:00:00 2001 From: Klaatu Date: Sun, 17 May 2015 15:33:21 +1200 Subject: bulk upload of source --- sighandler.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 sighandler.h (limited to 'sighandler.h') diff --git a/sighandler.h b/sighandler.h new file mode 100644 index 0000000..6a81f6c --- /dev/null +++ b/sighandler.h @@ -0,0 +1,26 @@ +static volatile char got_sig[4]; + +void sighandler(int sig) { + if (sig == SIGCHLD) return; +#ifdef NINIT_SIGNAL_HANDLER_CODED + { + unsigned char *Sig = (unsigned char *)NINIT_SIGNAL_HANDLER_CODED; + int k; + for (k=0; k<4; k++) + if ((unsigned char)sig == Sig[k]) + { got_sig[k] = 1; return; } + } +#else + + if (sig == SIGWINCH) got_sig[0]=1; + if (sig == SIGINT) got_sig[1]=1; +#ifdef INIT_SYSVINIT_SIGNALS + if (sig == SIGPWR) got_sig[2]=1; + if (sig == SIGHUP) got_sig[3]=1; +#endif +#endif /* NINIT_SIGNAL_HANDLER_CODED */ + +#ifdef INIT_SYSVINIT_SIGNALS + if (sig == SIGUSR1) { close(initctl); initctl = -5; } +#endif +} -- cgit v1.2.3