1 /* $NetBSD: sigact.h,v 1.3 2002/05/25 23:29:17 wiz Exp $ */ 2 3 /* NAME: 4 * sigact.h - sigaction et al 5 * 6 * SYNOPSIS: 7 * #include "sigact.h" 8 * 9 * DESCRIPTION: 10 * This header is the interface to a fake sigaction(2) 11 * implementation. It provides a POSIX compliant interface 12 * to whatever signal handling mechanisms are available. 13 * It also provides a Signal() function that is implemented 14 * in terms of sigaction(). 15 * If not using signal(2) as part of the underlying 16 * implementation (USE_SIGNAL or USE_SIGMASK), and 17 * NO_SIGNAL is not defined, it also provides a signal() 18 * function that calls Signal(). 19 * 20 * SEE ALSO: 21 * sigact.c 22 */ 23 /* 24 * RCSid: 25 * $NetBSD: sigact.h,v 1.3 2002/05/25 23:29:17 wiz Exp $ 26 */ 27 /* Changes to sigact.h for pdksh, Michael Rendell <michael@cs.mun.ca>: 28 * - changed SIG_HDLR to RETSIGTYPE for use with GNU autoconf 29 * - added RETSIGVAL 30 * - ifdef'd out ARGS(), volatile and const initializations 31 * - ifdef'd out sigset_t definition - let autoconf handle it 32 * - ifdef out routines not used in ksh if IS_KSH is defined 33 * (same in sigact.c). 34 */ 35 #ifndef _SIGACT_H 36 #define _SIGACT_H 37 38 /* 39 * most modern systems use void for signal handlers but 40 * not all. 41 */ 42 #ifndef RETSIGTYPE 43 # define RETSIGTYPE void 44 # define RETSIGVAL 45 #endif 46 47 #if 0 /* ARGS(), volatile and const are already set up in config*.h -mhr */ 48 #undef ARGS 49 #define ARGS(p) p 50 #endif 51 52 #ifndef IS_KSH 53 handler_t Signal ARGS((int sig, handler_t disp)); 54 #endif /* IS_KSH */ 55 56 /* 57 * if you want to install this header as signal.h, 58 * modify this to pick up the original signal.h 59 */ 60 #ifndef SIGKILL 61 # include <signal.h> 62 #endif 63 64 #ifndef SIG_ERR 65 # define SIG_ERR ((handler_t) -1) 66 #endif 67 #ifndef BADSIG 68 # define BADSIG SIG_ERR 69 #endif 70 71 #ifndef SA_NOCLDSTOP 72 /* we assume we need the fake sigaction */ 73 /* sa_flags */ 74 #define SA_NOCLDSTOP 1 /* don't send SIGCHLD on child stop */ 75 #define SA_RESTART 2 /* re-start I/O */ 76 77 /* sigprocmask flags */ 78 #define SIG_BLOCK 1 79 #define SIG_UNBLOCK 2 80 #define SIG_SETMASK 4 81 82 #if 0 /* autoconf will define sigset_t if it isn't available */ 83 /* 84 * this is a bit untidy 85 */ 86 #if !defined(__sys_stdtypes_h) 87 typedef unsigned int sigset_t; 88 #endif 89 #endif /* 0 */ 90 91 /* 92 * POSIX sa_handler should return void, but since we are 93 * implementing in terms of something else, it may 94 * be appropriate to use the normal RETSIGTYPE return type 95 */ 96 struct sigaction 97 { 98 handler_t sa_handler; 99 sigset_t sa_mask; 100 int sa_flags; 101 }; 102 103 104 int sigaction ARGS(( int sig, struct sigaction *act, struct sigaction *oact )); 105 int sigaddset ARGS(( sigset_t *mask, int sig )); 106 #ifndef IS_KSH 107 int sigdelset ARGS(( sigset_t *mask, int sig )); 108 #endif /* IS_KSH */ 109 int sigemptyset ARGS(( sigset_t *mask )); 110 #ifndef IS_KSH 111 int sigfillset ARGS(( sigset_t *mask )); 112 int sigismember ARGS(( sigset_t *mask, int sig )); 113 int sigpending ARGS(( sigset_t *set )); 114 #endif /* IS_KSH */ 115 int sigprocmask ARGS(( int how, sigset_t *set, sigset_t *oset )); 116 int sigsuspend ARGS(( sigset_t *mask )); 117 118 #ifndef sigmask 119 # define sigmask(s) (1<<((s)-1)) /* convert SIGnum to mask */ 120 #endif 121 #if !defined(NSIG) && defined(_NSIG) 122 # define NSIG _NSIG 123 #endif 124 #endif /* ! SA_NOCLDSTOP */ 125 #endif /* _SIGACT_H */ 126