1#ifndef _ASM_IA64_SIGINFO_H 2#define _ASM_IA64_SIGINFO_H 3 4/* 5 * Copyright (C) 1998-2002 Hewlett-Packard Co 6 * David Mosberger-Tang <davidm@hpl.hp.com> 7 */ 8 9#include <linux/types.h> 10 11typedef union sigval { 12 int sival_int; 13 void *sival_ptr; 14} sigval_t; 15 16#define SI_MAX_SIZE 128 17#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 4) 18 19typedef struct siginfo { 20 int si_signo; 21 int si_errno; 22 int si_code; 23 int __pad0; 24 25 union { 26 int _pad[SI_PAD_SIZE]; 27 28 /* kill() */ 29 struct { 30 pid_t _pid; /* sender's pid */ 31 uid_t _uid; /* sender's uid */ 32 } _kill; 33 34 /* POSIX.1b timers */ 35 struct { 36 unsigned int _timer1; 37 unsigned int _timer2; 38 } _timer; 39 40 /* POSIX.1b signals */ 41 struct { 42 pid_t _pid; /* sender's pid */ 43 uid_t _uid; /* sender's uid */ 44 sigval_t _sigval; 45 } _rt; 46 47 /* SIGCHLD */ 48 struct { 49 pid_t _pid; /* which child */ 50 uid_t _uid; /* sender's uid */ 51 int _status; /* exit code */ 52 clock_t _utime; 53 clock_t _stime; 54 } _sigchld; 55 56 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 57 struct { 58 void *_addr; /* faulting insn/memory ref. */ 59 int _imm; /* immediate value for "break" */ 60 unsigned int _flags; /* see below */ 61 unsigned long _isr; /* isr */ 62 } _sigfault; 63 64 /* SIGPOLL */ 65 struct { 66 long _band; /* POLL_IN, POLL_OUT, POLL_MSG (XPG requires a "long") */ 67 int _fd; 68 } _sigpoll; 69 /* SIGPROF */ 70 struct { 71 pid_t _pid; /* which child */ 72 uid_t _uid; /* sender's uid */ 73 unsigned long _pfm_ovfl_counters[4]; /* which PMU counter overflowed */ 74 } _sigprof; 75 } _sifields; 76} siginfo_t; 77 78/* 79 * How these fields are to be accessed. 80 */ 81#define si_pid _sifields._kill._pid 82#define si_uid _sifields._kill._uid 83#define si_status _sifields._sigchld._status 84#define si_utime _sifields._sigchld._utime 85#define si_stime _sifields._sigchld._stime 86#define si_value _sifields._rt._sigval 87#define si_int _sifields._rt._sigval.sival_int 88#define si_ptr _sifields._rt._sigval.sival_ptr 89#define si_addr _sifields._sigfault._addr 90#define si_imm _sifields._sigfault._imm /* as per UNIX SysV ABI spec */ 91#define si_flags _sifields._sigfault._flags 92/* 93 * si_isr is valid for SIGILL, SIGFPE, SIGSEGV, SIGBUS, and SIGTRAP provided that 94 * si_code is non-zero and __ISR_VALID is set in si_flags. 95 */ 96#define si_isr _sifields._sigfault._isr 97#define si_band _sifields._sigpoll._band 98#define si_fd _sifields._sigpoll._fd 99#define si_pfm_ovfl _sifields._sigprof._pfm_ovfl_counters 100 101/* 102 * Flag values for si_flags: 103 */ 104#define __ISR_VALID_BIT 0 105#define __ISR_VALID (1 << __ISR_VALID_BIT) 106 107/* 108 * si_code values 109 * Positive values for kernel-generated signals. 110 */ 111#ifdef __KERNEL__ 112#define __SI_MASK 0xffff0000 113#define __SI_KILL (0 << 16) 114#define __SI_TIMER (1 << 16) 115#define __SI_POLL (2 << 16) 116#define __SI_FAULT (3 << 16) 117#define __SI_CHLD (4 << 16) 118#define __SI_RT (5 << 16) 119#define __SI_PROF (6 << 16) 120#define __SI_CODE(T,N) ((T) << 16 | ((N) & 0xffff)) 121#else 122#define __SI_KILL 0 123#define __SI_TIMER 0 124#define __SI_POLL 0 125#define __SI_FAULT 0 126#define __SI_CHLD 0 127#define __SI_RT 0 128#define __SI_CODE(T,N) (N) 129#endif 130 131#define SI_USER 0 /* sent by kill, sigsend, raise */ 132#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 133#define SI_QUEUE (-1) /* sent by sigqueue */ 134#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */ 135#define SI_MESGQ (-3) /* sent by real time mesq state change */ 136#define SI_ASYNCIO (-4) /* sent by AIO completion */ 137#define SI_SIGIO (-5) /* sent by queued SIGIO */ 138#define SI_TKILL (-6) /* sent by tkill system call */ 139 140#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) 141#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) 142 143/* 144 * SIGILL si_codes 145 */ 146#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */ 147#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */ 148#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */ 149#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */ 150#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */ 151#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */ 152#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */ 153#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */ 154#define ILL_BADIADDR (__SI_FAULT|9) /* unimplemented instruction address */ 155#define __ILL_BREAK (__SI_FAULT|10) /* illegal break */ 156#define __ILL_BNDMOD (__SI_FAULT|11) /* bundle-update (modification) in progress */ 157#define NSIGILL 11 158 159/* 160 * SIGFPE si_codes 161 */ 162#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */ 163#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */ 164#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */ 165#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */ 166#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */ 167#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */ 168#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */ 169#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */ 170#define __FPE_DECOVF (__SI_FAULT|9) /* decimal overflow */ 171#define __FPE_DECDIV (__SI_FAULT|10) /* decimal division by zero */ 172#define __FPE_DECERR (__SI_FAULT|11) /* packed decimal error */ 173#define __FPE_INVASC (__SI_FAULT|12) /* invalid ASCII digit */ 174#define __FPE_INVDEC (__SI_FAULT|13) /* invalid decimal digit */ 175#define NSIGFPE 13 176 177/* 178 * SIGSEGV si_codes 179 */ 180#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */ 181#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */ 182#define __SEGV_PSTKOVF (__SI_FAULT|3) /* paragraph stack overflow */ 183#define NSIGSEGV 3 184 185/* 186 * SIGBUS si_codes 187 */ 188#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */ 189#define BUS_ADRERR (__SI_FAULT|2) /* non-existant physical address */ 190#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */ 191#define NSIGBUS 3 192 193/* 194 * SIGTRAP si_codes 195 */ 196#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */ 197#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */ 198#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */ 199#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint or watchpoint */ 200#define NSIGTRAP 4 201 202/* 203 * SIGCHLD si_codes 204 */ 205#define CLD_EXITED (__SI_CHLD|1) /* child has exited */ 206#define CLD_KILLED (__SI_CHLD|2) /* child was killed */ 207#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */ 208#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */ 209#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */ 210#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */ 211#define NSIGCHLD 6 212 213/* 214 * SIGPOLL si_codes 215 */ 216#define POLL_IN (__SI_POLL|1) /* data input available */ 217#define POLL_OUT (__SI_POLL|2) /* output buffers available */ 218#define POLL_MSG (__SI_POLL|3) /* input message available */ 219#define POLL_ERR (__SI_POLL|4) /* i/o error */ 220#define POLL_PRI (__SI_POLL|5) /* high priority input available */ 221#define POLL_HUP (__SI_POLL|6) /* device disconnected */ 222#define NSIGPOLL 6 223 224/* 225 * SIGPROF si_codes 226 */ 227#define PROF_OVFL (__SI_PROF|1) /* some counters overflowed */ 228 229/* 230 * sigevent definitions 231 * 232 * It seems likely that SIGEV_THREAD will have to be handled from userspace, libpthread 233 * transmuting it to SIGEV_SIGNAL, which the thread manager then catches and does the 234 * appropriate nonsense. However, everything is written out here so as to not get lost. 235 */ 236#define SIGEV_SIGNAL 0 /* notify via signal */ 237#define SIGEV_NONE 1 /* other notification: meaningless */ 238#define SIGEV_THREAD 2 /* deliver via thread creation */ 239 240#define SIGEV_MAX_SIZE 64 241#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 4) 242 243typedef struct sigevent { 244 sigval_t sigev_value; 245 int sigev_signo; 246 int sigev_notify; 247 union { 248 int _pad[SIGEV_PAD_SIZE]; 249 250 struct { 251 void (*_function)(sigval_t); 252 void *_attribute; /* really pthread_attr_t */ 253 } _sigev_thread; 254 } _sigev_un; 255} sigevent_t; 256 257#define sigev_notify_function _sigev_un._sigev_thread._function 258#define sigev_notify_attributes _sigev_un._sigev_thread._attribute 259 260#ifdef __KERNEL__ 261#include <linux/string.h> 262 263static inline void 264copy_siginfo (siginfo_t *to, siginfo_t *from) 265{ 266 if (from->si_code < 0) 267 memcpy(to, from, sizeof(siginfo_t)); 268 else 269 /* _sigchld is currently the largest know union member */ 270 memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld)); 271} 272 273extern int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from); 274extern int copy_siginfo_from_user(siginfo_t *to, siginfo_t *from); 275 276#endif /* __KERNEL__ */ 277 278#endif /* _ASM_IA64_SIGINFO_H */ 279