aboutsummaryrefslogtreecommitdiff
path: root/sighandler.h
diff options
context:
space:
mode:
authorKlaatu <[email protected]>2015-05-17 15:33:21 +1200
committerKlaatu <[email protected]>2015-05-17 15:33:21 +1200
commitb0de699679e8f1e39af847ed172d1ba605b4370c (patch)
tree01dac00471d61f727394e508c613b29cff0ceae5 /sighandler.h
bulk upload of source
Diffstat (limited to 'sighandler.h')
-rw-r--r--sighandler.h26
1 files changed, 26 insertions, 0 deletions
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
+}