19865aeaaSBen Gras /* The <signal.h> header defines all the ANSI and POSIX signals. 29865aeaaSBen Gras * MINIX supports all the signals required by POSIX. They are defined below. 39865aeaaSBen Gras * Some additional signals are also supported. 49865aeaaSBen Gras */ 59865aeaaSBen Gras 69865aeaaSBen Gras #ifndef _SIGNAL_H 79865aeaaSBen Gras #define _SIGNAL_H 89865aeaaSBen Gras 99865aeaaSBen Gras #ifndef _ANSI_H 109865aeaaSBen Gras #include <ansi.h> 119865aeaaSBen Gras #endif 129865aeaaSBen Gras #ifdef _POSIX_SOURCE 139865aeaaSBen Gras #ifndef _TYPES_H 149865aeaaSBen Gras #include <sys/types.h> 159865aeaaSBen Gras #endif 169865aeaaSBen Gras #endif 179865aeaaSBen Gras 189865aeaaSBen Gras /* Here are types that are closely associated with signal handling. */ 199865aeaaSBen Gras typedef int sig_atomic_t; 209865aeaaSBen Gras 219865aeaaSBen Gras #ifdef _POSIX_SOURCE 229865aeaaSBen Gras #ifndef _SIGSET_T 239865aeaaSBen Gras #define _SIGSET_T 249865aeaaSBen Gras typedef unsigned long sigset_t; 259865aeaaSBen Gras #endif 269865aeaaSBen Gras #endif 279865aeaaSBen Gras 289865aeaaSBen Gras #define SIGHUP 1 /* hangup */ 299865aeaaSBen Gras #define SIGINT 2 /* interrupt (DEL) */ 309865aeaaSBen Gras #define SIGQUIT 3 /* quit (ASCII FS) */ 319865aeaaSBen Gras #define SIGILL 4 /* illegal instruction */ 329865aeaaSBen Gras #define SIGTRAP 5 /* trace trap (not reset when caught) */ 339865aeaaSBen Gras #define SIGABRT 6 /* IOT instruction */ 34*d430c4faSPhilip Homburg #define SIGBUS 7 /* bus error */ 359865aeaaSBen Gras #define SIGFPE 8 /* floating point exception */ 369865aeaaSBen Gras #define SIGKILL 9 /* kill (cannot be caught or ignored) */ 379865aeaaSBen Gras #define SIGUSR1 10 /* user defined signal # 1 */ 389865aeaaSBen Gras #define SIGSEGV 11 /* segmentation violation */ 399865aeaaSBen Gras #define SIGUSR2 12 /* user defined signal # 2 */ 409865aeaaSBen Gras #define SIGPIPE 13 /* write on a pipe with no one to read it */ 419865aeaaSBen Gras #define SIGALRM 14 /* alarm clock */ 429865aeaaSBen Gras #define SIGTERM 15 /* software termination signal from kill */ 439865aeaaSBen Gras #define SIGCHLD 17 /* child process terminated or stopped */ 449865aeaaSBen Gras 450129d98aSJorrit Herder /* MINIX specific signals. These signals are not used by user proceses, 460129d98aSJorrit Herder * but meant to inform system processes, like the PM, about system events. 470129d98aSJorrit Herder */ 480129d98aSJorrit Herder #define SIGKMESS 18 /* new kernel message */ 490129d98aSJorrit Herder #define SIGKSIG 19 /* kernel signal pending */ 500129d98aSJorrit Herder #define SIGKSTOP 20 /* kernel shutting down */ 510129d98aSJorrit Herder 528c4166eeSBen Gras /* Regular signals. */ 538c4166eeSBen Gras #define SIGWINCH 21 /* window size has changed */ 548c4166eeSBen Gras 558c4166eeSBen Gras #define _NSIG 21 /* number of signals used */ 568c4166eeSBen Gras 579865aeaaSBen Gras /* POSIX requires the following signals to be defined, even if they are 589865aeaaSBen Gras * not supported. Here are the definitions, but they are not supported. 599865aeaaSBen Gras */ 609865aeaaSBen Gras #define SIGCONT 18 /* continue if stopped */ 619865aeaaSBen Gras #define SIGSTOP 19 /* stop signal */ 629865aeaaSBen Gras #define SIGTSTP 20 /* interactive stop signal */ 639865aeaaSBen Gras #define SIGTTIN 21 /* background process wants to read */ 649865aeaaSBen Gras #define SIGTTOU 22 /* background process wants to write */ 659865aeaaSBen Gras 66*d430c4faSPhilip Homburg #ifdef _MINIX 67*d430c4faSPhilip Homburg #define SIGIOT SIGABRT /* for people who speak PDP-11 */ 68*d430c4faSPhilip Homburg #endif 69*d430c4faSPhilip Homburg 709865aeaaSBen Gras /* The sighandler_t type is not allowed unless _POSIX_SOURCE is defined. */ 719865aeaaSBen Gras typedef void _PROTOTYPE( (*__sighandler_t), (int) ); 729865aeaaSBen Gras 739865aeaaSBen Gras /* Macros used as function pointers. */ 749865aeaaSBen Gras #define SIG_ERR ((__sighandler_t) -1) /* error return */ 759865aeaaSBen Gras #define SIG_DFL ((__sighandler_t) 0) /* default signal handling */ 769865aeaaSBen Gras #define SIG_IGN ((__sighandler_t) 1) /* ignore signal */ 779865aeaaSBen Gras #define SIG_HOLD ((__sighandler_t) 2) /* block signal */ 789865aeaaSBen Gras #define SIG_CATCH ((__sighandler_t) 3) /* catch signal */ 790129d98aSJorrit Herder #define SIG_MESS ((__sighandler_t) 4) /* pass as message (MINIX) */ 809865aeaaSBen Gras 819865aeaaSBen Gras #ifdef _POSIX_SOURCE 829865aeaaSBen Gras struct sigaction { 839865aeaaSBen Gras __sighandler_t sa_handler; /* SIG_DFL, SIG_IGN, or pointer to function */ 849865aeaaSBen Gras sigset_t sa_mask; /* signals to be blocked during handler */ 859865aeaaSBen Gras int sa_flags; /* special flags */ 869865aeaaSBen Gras }; 879865aeaaSBen Gras 889865aeaaSBen Gras /* Fields for sa_flags. */ 899865aeaaSBen Gras #define SA_ONSTACK 0x0001 /* deliver signal on alternate stack */ 909865aeaaSBen Gras #define SA_RESETHAND 0x0002 /* reset signal handler when signal caught */ 919865aeaaSBen Gras #define SA_NODEFER 0x0004 /* don't block signal while catching it */ 929865aeaaSBen Gras #define SA_RESTART 0x0008 /* automatic system call restart */ 939865aeaaSBen Gras #define SA_SIGINFO 0x0010 /* extended signal handling */ 949865aeaaSBen Gras #define SA_NOCLDWAIT 0x0020 /* don't create zombies */ 959865aeaaSBen Gras #define SA_NOCLDSTOP 0x0040 /* don't receive SIGCHLD when child stops */ 969865aeaaSBen Gras 979865aeaaSBen Gras /* POSIX requires these values for use with sigprocmask(2). */ 989865aeaaSBen Gras #define SIG_BLOCK 0 /* for blocking signals */ 999865aeaaSBen Gras #define SIG_UNBLOCK 1 /* for unblocking signals */ 1009865aeaaSBen Gras #define SIG_SETMASK 2 /* for setting the signal mask */ 1019865aeaaSBen Gras #define SIG_INQUIRE 4 /* for internal use only */ 1029865aeaaSBen Gras #endif /* _POSIX_SOURCE */ 1039865aeaaSBen Gras 1049865aeaaSBen Gras /* POSIX and ANSI function prototypes. */ 1059865aeaaSBen Gras _PROTOTYPE( int raise, (int _sig) ); 1069865aeaaSBen Gras _PROTOTYPE( __sighandler_t signal, (int _sig, __sighandler_t _func) ); 1079865aeaaSBen Gras 1089865aeaaSBen Gras #ifdef _POSIX_SOURCE 1099865aeaaSBen Gras _PROTOTYPE( int kill, (pid_t _pid, int _sig) ); 1109865aeaaSBen Gras _PROTOTYPE( int sigaction, 1119865aeaaSBen Gras (int _sig, const struct sigaction *_act, struct sigaction *_oact) ); 1129865aeaaSBen Gras _PROTOTYPE( int sigaddset, (sigset_t *_set, int _sig) ); 1139865aeaaSBen Gras _PROTOTYPE( int sigdelset, (sigset_t *_set, int _sig) ); 1149865aeaaSBen Gras _PROTOTYPE( int sigemptyset, (sigset_t *_set) ); 1159865aeaaSBen Gras _PROTOTYPE( int sigfillset, (sigset_t *_set) ); 1169865aeaaSBen Gras _PROTOTYPE( int sigismember, (const sigset_t *_set, int _sig) ); 1179865aeaaSBen Gras _PROTOTYPE( int sigpending, (sigset_t *_set) ); 1189865aeaaSBen Gras _PROTOTYPE( int sigprocmask, 1199865aeaaSBen Gras (int _how, const sigset_t *_set, sigset_t *_oset) ); 1209865aeaaSBen Gras _PROTOTYPE( int sigsuspend, (const sigset_t *_sigmask) ); 1219865aeaaSBen Gras #endif 1229865aeaaSBen Gras 1239865aeaaSBen Gras #endif /* _SIGNAL_H */ 124