t2ex/bsd_source/lib/libc/src_bsd/include/sys/siginfo.h | bare source | permlink (0.04 seconds) |
1: /* $OpenBSD: siginfo.h,v 1.9 2005/12/13 00:35:23 millert Exp $ */ 2: 3: /* 4: * Copyright (c) 1997 Theo de Raadt 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: * 16: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26: */ 27: 28: #ifndef _SYS_SIGINFO_H 29: #define _SYS_SIGINFO_H 30: 31: #include <sys/cdefs.h> 32: 33: union sigval { 34: int sival_int; /* integer value */ 35: void *sival_ptr; /* pointer value */ 36: }; 37: 38: /* 39: * Negative signal codes are reserved for future use for 40: * user generated signals. 41: */ 42: #define SI_FROMUSER(sip) ((sip)->si_code <= 0) 43: #define SI_FROMKERNEL(sip) ((sip)->si_code > 0) 44: 45: #define SI_NOINFO 32767 /* no signal information */ 46: #define SI_USER 0 /* user generated signal via kill() */ 47: #define SI_LWP (-1) /* user generated signal via lwp_kill()*/ 48: #define SI_QUEUE (-2) /* user generated signal via sigqueue()*/ 49: #define SI_TIMER (-3) /* from timer expiration */ 50: 51: #if __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE 52: /* 53: * The machine dependent signal codes (SIGILL, SIGFPE, 54: * SIGSEGV, and SIGBUS) 55: */ 56: #define ILL_ILLOPC 1 /* illegal opcode */ 57: #define ILL_ILLOPN 2 /* illegal operand */ 58: #define ILL_ILLADR 3 /* illegal addressing mode */ 59: #define ILL_ILLTRP 4 /* illegal trap */ 60: #define ILL_PRVOPC 5 /* privileged opcode */ 61: #define ILL_PRVREG 6 /* privileged register */ 62: #define ILL_COPROC 7 /* co-processor */ 63: #define ILL_BADSTK 8 /* bad stack */ 64: #define NSIGILL 8 65: 66: #define EMT_TAGOVF 1 /* tag overflow */ 67: #define NSIGEMT 1 68: 69: #define FPE_INTDIV 1 /* integer divide by zero */ 70: #define FPE_INTOVF 2 /* integer overflow */ 71: #define FPE_FLTDIV 3 /* floating point divide by zero */ 72: #define FPE_FLTOVF 4 /* floating point overflow */ 73: #define FPE_FLTUND 5 /* floating point underflow */ 74: #define FPE_FLTRES 6 /* floating point inexact result */ 75: #define FPE_FLTINV 7 /* invalid floating point operation */ 76: #define FPE_FLTSUB 8 /* subscript out of range */ 77: #define NSIGFPE 8 78: 79: #define SEGV_MAPERR 1 /* address not mapped to object */ 80: #define SEGV_ACCERR 2 /* invalid permissions */ 81: #define NSIGSEGV 2 82: 83: #define BUS_ADRALN 1 /* invalid address alignment */ 84: #define BUS_ADRERR 2 /* non-existent physical address */ 85: #define BUS_OBJERR 3 /* object specific hardware error */ 86: #define NSIGBUS 3 87: 88: #endif /* __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE */ 89: 90: /* 91: * SIGTRAP signal codes 92: */ 93: #define TRAP_BRKPT 1 /* breakpoint trap */ 94: #define TRAP_TRACE 2 /* trace trap */ 95: #define NSIGTRAP 2 96: 97: /* 98: * SIGCLD signal codes 99: */ 100: #define CLD_EXITED 1 /* child has exited */ 101: #define CLD_KILLED 2 /* child was killed */ 102: #define CLD_DUMPED 3 /* child has coredumped */ 103: #define CLD_TRAPPED 4 /* traced child has stopped */ 104: #define CLD_STOPPED 5 /* child has stopped on signal */ 105: #define CLD_CONTINUED 6 /* stopped child has continued */ 106: #define NSIGCLD 6 107: 108: #if 0 109: /* 110: * SIGPOLL signal codes - not supported 111: */ 112: #define POLL_IN 1 /* input available */ 113: #define POLL_OUT 2 /* output possible */ 114: #define POLL_MSG 3 /* message available */ 115: #define POLL_ERR 4 /* I/O error */ 116: #define POLL_PRI 5 /* high priority input available */ 117: #define POLL_HUP 6 /* device disconnected */ 118: #define NSIGPOLL 6 119: 120: /* 121: * SIGPROF signal codes - not supported 122: */ 123: #define PROF_SIG 1 /* have to set code non-zero */ 124: #define NSIGPROF 1 125: #endif 126: 127: #define SI_MAXSZ 128 128: #define SI_PAD ((SI_MAXSZ / sizeof (int)) - 3) 129: 130: #include <sys/time.h> 131: 132: typedef struct { 133: int si_signo; /* signal from signal.h */ 134: int si_code; /* code from above */ 135: int si_errno; /* error from errno.h */ 136: union { 137: int _pad[SI_PAD]; /* for future growth */ 138: struct { /* kill(), SIGCLD, siqqueue() */ 139: pid_t _pid; /* process ID */ 140: union { 141: struct { 142: uid_t _uid; 143: union sigval _value; 144: } _kill; 145: struct { 146: clock_t _utime; 147: int _status; 148: clock_t _stime; 149: } _cld; 150: } _pdata; 151: } _proc; 152: struct { /* SIGSEGV, SIGBUS, SIGILL and SIGFPE */ 153: caddr_t _addr; /* faulting address */ 154: int _trapno; /* illegal trap number */ 155: } _fault; 156: #if 0 157: struct { /* SIGPOLL, SIGXFSZ */ 158: /* fd not currently available for SIGPOLL */ 159: int _fd; /* file descriptor */ 160: long _band; 161: } _file; 162: struct { /* SIGPROF */ 163: caddr_t _faddr; /* last fault address */ 164: timespec _tstamp; /* real time stamp */ 165: short _syscall; /* current syscall */ 166: char _nsysarg; /* number of arguments */ 167: char _fault; /* last fault type */ 168: long _sysarg[8]; /* syscall arguments */ 169: long _mstate[17]; /* exactly fills struct*/ 170: } _prof; 171: #endif 172: } _data; 173: } siginfo_t; 174: 175: #define si_pid _data._proc._pid 176: 177: #define si_status _data._proc._pdata._cld._status 178: #define si_stime _data._proc._pdata._cld._stime 179: #define si_utime _data._proc._pdata._cld._utime 180: #define si_uid _data._proc._pdata._kill._uid 181: #define si_value _data._proc._pdata._kill._value 182: #define si_addr _data._fault._addr 183: #define si_trapno _data._fault._trapno 184: #define si_fd _data._file._fd 185: #define si_band _data._file._band 186: 187: #define si_tstamp _data._prof._tstamp 188: #define si_syscall _data._prof._syscall 189: #define si_nsysarg _data._prof._nsysarg 190: #define si_sysarg _data._prof._sysarg 191: #define si_fault _data._prof._fault 192: #define si_faddr _data._prof._faddr 193: #define si_mstate _data._prof._mstate 194: 195: #if defined(_KERNEL) 196: void initsiginfo(siginfo_t *, int, u_long, int, union sigval); 197: #endif 198: 199: #endif /* _SYS_SIGINFO_H */