From b4909649d40f10cf79dd3cbed69bf8709f3e0786 Mon Sep 17 00:00:00 2001 From: shivers Date: Thu, 12 Sep 1996 04:35:43 +0000 Subject: [PATCH] Signal-handler support. --- scsh/bsd/signals1.c | 129 ++++++++++++++++++++++++++++++++++++++++++++ scsh/bsd/signals1.h | 4 ++ 2 files changed, 133 insertions(+) create mode 100644 scsh/bsd/signals1.c create mode 100644 scsh/bsd/signals1.h diff --git a/scsh/bsd/signals1.c b/scsh/bsd/signals1.c new file mode 100644 index 0000000..14bd1b3 --- /dev/null +++ b/scsh/bsd/signals1.c @@ -0,0 +1,129 @@ +/* Need to turn off synchronous error signals (SIGPIPE, SIGSYS). */ + +#include "../scsh_aux.h" + +/* Make sure our exports match up w/the implementation: */ +#include "signals1.h" + +/* This table converts Unix signal numbers to S48/scsh interrupt numbers. +** If the signal doesn't have an interrupt number, the entry is -1. +** (Only asynchronous signals have interrupt numbers.) +** +** Note that we bake into this table the integer values of the signals -- +** i.e., we assume that SIGHUP=1, SIGALRM=15, etc. So this definition is +** very system-dependent. +*/ +const int sig2int[] = { + -1, /* 0 is not a signal */ + scshint_hup, /* SIGHUP */ + scshint_keyboard, /* SIGINT */ + scshint_quit, /* SIGQUIT */ + -1, /* SIGILL */ + -1, /* SIGTRAP */ + -1, /* SIGABRT & SIGIOT */ + -1, /* SIGEMT */ + -1, /* SIGFPE */ + -1, /* SIGKILL */ + -1, /* SIGBUS */ + -1, /* SIGSEGV */ + -1, /* SIGSYS */ + -1, /* SIGPIPE */ + scshint_alarm, /* SIGALRM */ + scshint_term, /* SIGTERM */ + scshint_urg, /* SIGURG */ + -1, /* SIGSTOP */ + scshint_tstp, /* SIGTSTP */ + scshint_cont, /* SIGCONT */ + scshint_chld, /* SIGCHLD */ + -1, /* scshint_ttyin, /* SIGTTIN */ + -1, /* scshint_ttou, /* SIGTTOU */ + scshint_io, /* SIGIO */ + scshint_xcpu, /* SIGXCPU */ + scshint_xfsz, /* SIGXFSZ */ + scshint_vtalrm, /* SIGVTALRM */ + scshint_prof, /* SIGPROF */ + scshint_winch, /* SIGWINCH */ + scshint_info, /* SIGINFO */ + scshint_usr1, /* SIGUSR1 */ + scshint_usr2 /* SIGUSR2 */ + }; + +const int max_sig = 31; /* SIGUSR2 */ + +/* +scshint_alarm +scshint_keyboard +scshint_memory_shortage +scshint_chld +scshint_cont +scshint_hup +scshint_quit +scshint_term +scshint_tstp +scshint_usr1 +scshint_usr2 +scshint_info +scshint_io +scshint_poll +scshint_prof +scshint_pwr +scshint_urg +scshint_vtalrm +scshint_winch +scshint_xcpu +scshint_xfsz + +SIGALRM +SIGCHLD +SIGCONT +SIGHUP +SIGINFO +SIGINT +SIGIO +SIGPROF +SIGQUIT +SIGTERM +SIGTSTP +SIGTTIN +SIGTTOU +SIGURG +SIGUSR1 +SIGUSR2 +SIGVTALRM +SIGWINCH +SIGXCPU +SIGXFSZ + +SIGHUP 1 +SIGINT 2 +SIGQUIT 3 +SIGILL 4 +SIGTRAP 5 +SIGABRT 6 +SIGIOT SIGABRT +SIGEMT 7 +SIGFPE 8 +SIGKILL 9 +SIGBUS 10 +SIGSEGV 11 +SIGSYS 12 +SIGPIPE 13 +SIGALRM 14 +SIGTERM 15 +SIGURG 16 +SIGSTOP 17 +SIGTSTP 18 +SIGCONT 19 +SIGCHLD 20 +SIGTTIN 21 +SIGTTOU 22 +SIGIO 23 +SIGXCPU 24 +SIGXFSZ 25 +SIGVTALRM 26 +SIGPROF 27 +SIGWINCH 28 +SIGINFO 29 +SIGUSR1 30 +SIGUSR2 31 +*/ diff --git a/scsh/bsd/signals1.h b/scsh/bsd/signals1.h new file mode 100644 index 0000000..64bf896 --- /dev/null +++ b/scsh/bsd/signals1.h @@ -0,0 +1,4 @@ +/* Exports from signals1.c */ + +const int sig2int[]; +const int max_sig;