1 /* $NetBSD: ibcs2_signal.h,v 1.21 2013/01/02 18:50:07 dsl Exp $ */ 2 3 /* 4 * Copyright (c) 1994, 1995 Scott Bartram 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by Scott Bartram. 18 * 4. The name of the author may not be used to endorse or promote products 19 * derived from this software without specific prior written permission 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 #ifndef _IBCS2_SIGNAL_H 34 #define _IBCS2_SIGNAL_H 35 36 #define IBCS2_SIGHUP 1 37 #define IBCS2_SIGINT 2 38 #define IBCS2_SIGQUIT 3 39 #define IBCS2_SIGILL 4 40 #define IBCS2_SIGTRAP 5 41 #define IBCS2_SIGIOT 6 42 #define IBCS2_SIGABRT 6 43 #define IBCS2_SIGEMT 7 44 #define IBCS2_SIGFPE 8 45 #define IBCS2_SIGKILL 9 46 #define IBCS2_SIGBUS 10 47 #define IBCS2_SIGSEGV 11 48 #define IBCS2_SIGSYS 12 49 #define IBCS2_SIGPIPE 13 50 #define IBCS2_SIGALRM 14 51 #define IBCS2_SIGTERM 15 52 #define IBCS2_SIGUSR1 16 53 #define IBCS2_SIGUSR2 17 54 #define IBCS2_SIGCLD 18 55 #define IBCS2_SIGPWR 19 56 #define IBCS2_SIGWINCH 20 57 /*#define IBCS2_SIGPHONE 21*/ 58 #define IBCS2_SIGPOLL 22 59 #define IBCS2_NSIG 32 60 61 /* 62 * SCO-specific 63 */ 64 #define IBCS2_SIGSTOP 23 65 #define IBCS2_SIGTSTP 24 66 #define IBCS2_SIGCONT 25 67 #define IBCS2_SIGTTIN 26 68 #define IBCS2_SIGTTOU 27 69 #define IBCS2_SIGVTALRM 28 70 #define IBCS2_SIGPROF 29 71 #define IBCS2_SIGXCPU 30 72 #define IBCS2_SIGXFSZ 31 73 74 #define IBCS2_SIGNO_MASK 0x00FF 75 #define IBCS2_SIGNAL_MASK 0x0000 76 #define IBCS2_SIGSET_MASK 0x0100 77 #define IBCS2_SIGHOLD_MASK 0x0200 78 #define IBCS2_SIGRELSE_MASK 0x0400 79 #define IBCS2_SIGIGNORE_MASK 0x0800 80 #define IBCS2_SIGPAUSE_MASK 0x1000 81 82 #define IBCS2_SIGNO(x) ((x) & IBCS2_SIGNO_MASK) 83 #define IBCS2_SIGCALL(x) ((x) & ~IBCS2_SIGNO_MASK) 84 85 #define IBCS2_SIG_DFL (void(*)(int)) 0 86 #define IBCS2_SIG_ERR (void(*)(int)) (-1) 87 #define IBCS2_SIG_IGN (void(*)(int)) 1 88 #define IBCS2_SIG_HOLD (void(*)(int)) 2 89 90 #define IBCS2_SIG_SETMASK 0 91 #define IBCS2_SIG_BLOCK 1 92 #define IBCS2_SIG_UNBLOCK 2 93 94 typedef long ibcs2_sigset_t; 95 typedef void (*ibcs2_sig_t)(int); 96 97 struct ibcs2_sigaction { 98 ibcs2_sig_t ibcs2_sa_handler; 99 ibcs2_sigset_t ibcs2_sa_mask; 100 int ibcs2_sa_flags; 101 }; 102 103 /* sa_flags */ 104 #define IBCS2_SA_NOCLDSTOP 0x00000001 105 #define IBCS2_SA_RESETHAND 0x00000002 106 #define IBCS2_SA_RESTART 0x00000004 107 #define IBCS2_SA_SIGINFO 0x00000008 108 #define IBCS2_SA_NODEFER 0x00000010 109 #define IBCS2_SA_ONSTACK 0x00000200 110 #define IBCS2_SA_NOCLDWAIT 0x00010000 111 #define IBCS2_SA_ALLBITS 0x0001021f 112 113 struct ibcs2_sigaltstack { 114 void *ss_sp; 115 ibcs2_size_t ss_size; 116 int ss_flags; 117 }; 118 119 /* ss_flags */ 120 #define IBCS2_SS_ONSTACK 0x00000001 121 #define IBCS2_SS_DISABLE 0x00000002 122 #define IBCS2_SS_ALLBITS 0x00000003 123 124 #ifdef _KERNEL 125 extern const int native_to_ibcs2_signo[]; 126 void ibcs2_to_native_sigset(const ibcs2_sigset_t *, sigset_t *); 127 void native_to_ibcs2_sigset(const sigset_t *, ibcs2_sigset_t *); 128 129 void ibcs2_sendsig(const struct ksiginfo *, const sigset_t *); 130 #endif 131 132 #endif /* _IBCS2_SIGNAL_H */ 133