18a1ab315SDavid Howells #ifndef _UAPI_ASM_GENERIC_SIGINFO_H 28a1ab315SDavid Howells #define _UAPI_ASM_GENERIC_SIGINFO_H 38a1ab315SDavid Howells 48a1ab315SDavid Howells #include <linux/compiler.h> 58a1ab315SDavid Howells #include <linux/types.h> 68a1ab315SDavid Howells 78a1ab315SDavid Howells typedef union sigval { 88a1ab315SDavid Howells int sival_int; 98a1ab315SDavid Howells void __user *sival_ptr; 108a1ab315SDavid Howells } sigval_t; 118a1ab315SDavid Howells 128a1ab315SDavid Howells /* 138a1ab315SDavid Howells * This is the size (including padding) of the part of the 148a1ab315SDavid Howells * struct siginfo that is before the union. 158a1ab315SDavid Howells */ 168a1ab315SDavid Howells #ifndef __ARCH_SI_PREAMBLE_SIZE 178a1ab315SDavid Howells #define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) 188a1ab315SDavid Howells #endif 198a1ab315SDavid Howells 208a1ab315SDavid Howells #define SI_MAX_SIZE 128 218a1ab315SDavid Howells #ifndef SI_PAD_SIZE 228a1ab315SDavid Howells #define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int)) 238a1ab315SDavid Howells #endif 248a1ab315SDavid Howells 258a1ab315SDavid Howells #ifndef __ARCH_SI_UID_T 268a1ab315SDavid Howells #define __ARCH_SI_UID_T __kernel_uid32_t 278a1ab315SDavid Howells #endif 288a1ab315SDavid Howells 298a1ab315SDavid Howells /* 308a1ab315SDavid Howells * The default "si_band" type is "long", as specified by POSIX. 318a1ab315SDavid Howells * However, some architectures want to override this to "int" 328a1ab315SDavid Howells * for historical compatibility reasons, so we allow that. 338a1ab315SDavid Howells */ 348a1ab315SDavid Howells #ifndef __ARCH_SI_BAND_T 358a1ab315SDavid Howells #define __ARCH_SI_BAND_T long 368a1ab315SDavid Howells #endif 378a1ab315SDavid Howells 388a1ab315SDavid Howells #ifndef __ARCH_SI_CLOCK_T 398a1ab315SDavid Howells #define __ARCH_SI_CLOCK_T __kernel_clock_t 408a1ab315SDavid Howells #endif 418a1ab315SDavid Howells 428a1ab315SDavid Howells #ifndef __ARCH_SI_ATTRIBUTES 438a1ab315SDavid Howells #define __ARCH_SI_ATTRIBUTES 448a1ab315SDavid Howells #endif 458a1ab315SDavid Howells 468a1ab315SDavid Howells #ifndef HAVE_ARCH_SIGINFO_T 478a1ab315SDavid Howells 488a1ab315SDavid Howells typedef struct siginfo { 498a1ab315SDavid Howells int si_signo; 508a1ab315SDavid Howells int si_errno; 518a1ab315SDavid Howells int si_code; 528a1ab315SDavid Howells 538a1ab315SDavid Howells union { 548a1ab315SDavid Howells int _pad[SI_PAD_SIZE]; 558a1ab315SDavid Howells 568a1ab315SDavid Howells /* kill() */ 578a1ab315SDavid Howells struct { 588a1ab315SDavid Howells __kernel_pid_t _pid; /* sender's pid */ 598a1ab315SDavid Howells __ARCH_SI_UID_T _uid; /* sender's uid */ 608a1ab315SDavid Howells } _kill; 618a1ab315SDavid Howells 628a1ab315SDavid Howells /* POSIX.1b timers */ 638a1ab315SDavid Howells struct { 648a1ab315SDavid Howells __kernel_timer_t _tid; /* timer id */ 658a1ab315SDavid Howells int _overrun; /* overrun count */ 668a1ab315SDavid Howells char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)]; 678a1ab315SDavid Howells sigval_t _sigval; /* same as below */ 688a1ab315SDavid Howells int _sys_private; /* not to be passed to user */ 698a1ab315SDavid Howells } _timer; 708a1ab315SDavid Howells 718a1ab315SDavid Howells /* POSIX.1b signals */ 728a1ab315SDavid Howells struct { 738a1ab315SDavid Howells __kernel_pid_t _pid; /* sender's pid */ 748a1ab315SDavid Howells __ARCH_SI_UID_T _uid; /* sender's uid */ 758a1ab315SDavid Howells sigval_t _sigval; 768a1ab315SDavid Howells } _rt; 778a1ab315SDavid Howells 788a1ab315SDavid Howells /* SIGCHLD */ 798a1ab315SDavid Howells struct { 808a1ab315SDavid Howells __kernel_pid_t _pid; /* which child */ 818a1ab315SDavid Howells __ARCH_SI_UID_T _uid; /* sender's uid */ 828a1ab315SDavid Howells int _status; /* exit code */ 838a1ab315SDavid Howells __ARCH_SI_CLOCK_T _utime; 848a1ab315SDavid Howells __ARCH_SI_CLOCK_T _stime; 858a1ab315SDavid Howells } _sigchld; 868a1ab315SDavid Howells 878a1ab315SDavid Howells /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 888a1ab315SDavid Howells struct { 898a1ab315SDavid Howells void __user *_addr; /* faulting insn/memory ref. */ 908a1ab315SDavid Howells #ifdef __ARCH_SI_TRAPNO 918a1ab315SDavid Howells int _trapno; /* TRAP # which caused the signal */ 928a1ab315SDavid Howells #endif 938a1ab315SDavid Howells short _addr_lsb; /* LSB of the reported address */ 94cd0ea35fSDave Hansen union { 95cd0ea35fSDave Hansen /* used when si_code=SEGV_BNDERR */ 96ee1b58d3SQiaowei Ren struct { 97ee1b58d3SQiaowei Ren void __user *_lower; 98ee1b58d3SQiaowei Ren void __user *_upper; 99ee1b58d3SQiaowei Ren } _addr_bnd; 100cd0ea35fSDave Hansen /* used when si_code=SEGV_PKUERR */ 10149cd53bfSDave Hansen __u32 _pkey; 102cd0ea35fSDave Hansen }; 1038a1ab315SDavid Howells } _sigfault; 1048a1ab315SDavid Howells 1058a1ab315SDavid Howells /* SIGPOLL */ 1068a1ab315SDavid Howells struct { 1078a1ab315SDavid Howells __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 1088a1ab315SDavid Howells int _fd; 1098a1ab315SDavid Howells } _sigpoll; 1108a1ab315SDavid Howells 1118a1ab315SDavid Howells /* SIGSYS */ 1128a1ab315SDavid Howells struct { 1138a1ab315SDavid Howells void __user *_call_addr; /* calling user insn */ 1148a1ab315SDavid Howells int _syscall; /* triggering system call number */ 1158a1ab315SDavid Howells unsigned int _arch; /* AUDIT_ARCH_* of syscall */ 1168a1ab315SDavid Howells } _sigsys; 1178a1ab315SDavid Howells } _sifields; 1188a1ab315SDavid Howells } __ARCH_SI_ATTRIBUTES siginfo_t; 1198a1ab315SDavid Howells 1208a1ab315SDavid Howells /* If the arch shares siginfo, then it has SIGSYS. */ 1218a1ab315SDavid Howells #define __ARCH_SIGSYS 1228a1ab315SDavid Howells #endif 1238a1ab315SDavid Howells 1248a1ab315SDavid Howells /* 1258a1ab315SDavid Howells * How these fields are to be accessed. 1268a1ab315SDavid Howells */ 1278a1ab315SDavid Howells #define si_pid _sifields._kill._pid 1288a1ab315SDavid Howells #define si_uid _sifields._kill._uid 1298a1ab315SDavid Howells #define si_tid _sifields._timer._tid 1308a1ab315SDavid Howells #define si_overrun _sifields._timer._overrun 1318a1ab315SDavid Howells #define si_sys_private _sifields._timer._sys_private 1328a1ab315SDavid Howells #define si_status _sifields._sigchld._status 1338a1ab315SDavid Howells #define si_utime _sifields._sigchld._utime 1348a1ab315SDavid Howells #define si_stime _sifields._sigchld._stime 1358a1ab315SDavid Howells #define si_value _sifields._rt._sigval 1368a1ab315SDavid Howells #define si_int _sifields._rt._sigval.sival_int 1378a1ab315SDavid Howells #define si_ptr _sifields._rt._sigval.sival_ptr 1388a1ab315SDavid Howells #define si_addr _sifields._sigfault._addr 1398a1ab315SDavid Howells #ifdef __ARCH_SI_TRAPNO 1408a1ab315SDavid Howells #define si_trapno _sifields._sigfault._trapno 1418a1ab315SDavid Howells #endif 1428a1ab315SDavid Howells #define si_addr_lsb _sifields._sigfault._addr_lsb 143ee1b58d3SQiaowei Ren #define si_lower _sifields._sigfault._addr_bnd._lower 144ee1b58d3SQiaowei Ren #define si_upper _sifields._sigfault._addr_bnd._upper 145cd0ea35fSDave Hansen #define si_pkey _sifields._sigfault._pkey 1468a1ab315SDavid Howells #define si_band _sifields._sigpoll._band 1478a1ab315SDavid Howells #define si_fd _sifields._sigpoll._fd 1488a1ab315SDavid Howells #ifdef __ARCH_SIGSYS 1498a1ab315SDavid Howells #define si_call_addr _sifields._sigsys._call_addr 1508a1ab315SDavid Howells #define si_syscall _sifields._sigsys._syscall 1518a1ab315SDavid Howells #define si_arch _sifields._sigsys._arch 1528a1ab315SDavid Howells #endif 1538a1ab315SDavid Howells 1548a1ab315SDavid Howells /* 1558a1ab315SDavid Howells * si_code values 1568a1ab315SDavid Howells * Digital reserves positive values for kernel-generated signals. 1578a1ab315SDavid Howells */ 1588a1ab315SDavid Howells #define SI_USER 0 /* sent by kill, sigsend, raise */ 1598a1ab315SDavid Howells #define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 1608a1ab315SDavid Howells #define SI_QUEUE -1 /* sent by sigqueue */ 161cc731525SEric W. Biederman #define SI_TIMER -2 /* sent by timer expiration */ 162cc731525SEric W. Biederman #define SI_MESGQ -3 /* sent by real time mesq state change */ 1638a1ab315SDavid Howells #define SI_ASYNCIO -4 /* sent by AIO completion */ 164cc731525SEric W. Biederman #define SI_SIGIO -5 /* sent by queued SIGIO */ 1658a1ab315SDavid Howells #define SI_TKILL -6 /* sent by tkill system call */ 1668a1ab315SDavid Howells #define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */ 1678a1ab315SDavid Howells 1688a1ab315SDavid Howells #define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) 1698a1ab315SDavid Howells #define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) 1708a1ab315SDavid Howells 1718a1ab315SDavid Howells /* 1728a1ab315SDavid Howells * SIGILL si_codes 1738a1ab315SDavid Howells */ 174cc731525SEric W. Biederman #define ILL_ILLOPC 1 /* illegal opcode */ 175cc731525SEric W. Biederman #define ILL_ILLOPN 2 /* illegal operand */ 176cc731525SEric W. Biederman #define ILL_ILLADR 3 /* illegal addressing mode */ 177cc731525SEric W. Biederman #define ILL_ILLTRP 4 /* illegal trap */ 178cc731525SEric W. Biederman #define ILL_PRVOPC 5 /* privileged opcode */ 179cc731525SEric W. Biederman #define ILL_PRVREG 6 /* privileged register */ 180cc731525SEric W. Biederman #define ILL_COPROC 7 /* coprocessor error */ 181cc731525SEric W. Biederman #define ILL_BADSTK 8 /* internal stack error */ 1828a1ab315SDavid Howells #define NSIGILL 8 1838a1ab315SDavid Howells 1848a1ab315SDavid Howells /* 1858a1ab315SDavid Howells * SIGFPE si_codes 1868a1ab315SDavid Howells */ 187cc731525SEric W. Biederman #define FPE_INTDIV 1 /* integer divide by zero */ 188cc731525SEric W. Biederman #define FPE_INTOVF 2 /* integer overflow */ 189cc731525SEric W. Biederman #define FPE_FLTDIV 3 /* floating point divide by zero */ 190cc731525SEric W. Biederman #define FPE_FLTOVF 4 /* floating point overflow */ 191cc731525SEric W. Biederman #define FPE_FLTUND 5 /* floating point underflow */ 192cc731525SEric W. Biederman #define FPE_FLTRES 6 /* floating point inexact result */ 193cc731525SEric W. Biederman #define FPE_FLTINV 7 /* floating point invalid operation */ 194cc731525SEric W. Biederman #define FPE_FLTSUB 8 /* subscript out of range */ 1958a1ab315SDavid Howells #define NSIGFPE 8 1968a1ab315SDavid Howells 1978a1ab315SDavid Howells /* 1988a1ab315SDavid Howells * SIGSEGV si_codes 1998a1ab315SDavid Howells */ 200cc731525SEric W. Biederman #define SEGV_MAPERR 1 /* address not mapped to object */ 201cc731525SEric W. Biederman #define SEGV_ACCERR 2 /* invalid permissions for mapped object */ 202cc731525SEric W. Biederman #define SEGV_BNDERR 3 /* failed address bound checks */ 203cc731525SEric W. Biederman #define SEGV_PKUERR 4 /* failed protection key checks */ 204cd0ea35fSDave Hansen #define NSIGSEGV 4 2058a1ab315SDavid Howells 2068a1ab315SDavid Howells /* 2078a1ab315SDavid Howells * SIGBUS si_codes 2088a1ab315SDavid Howells */ 209cc731525SEric W. Biederman #define BUS_ADRALN 1 /* invalid address alignment */ 210cc731525SEric W. Biederman #define BUS_ADRERR 2 /* non-existent physical address */ 211cc731525SEric W. Biederman #define BUS_OBJERR 3 /* object specific hardware error */ 2128a1ab315SDavid Howells /* hardware memory error consumed on a machine check: action required */ 213cc731525SEric W. Biederman #define BUS_MCEERR_AR 4 2148a1ab315SDavid Howells /* hardware memory error detected in process but not consumed: action optional*/ 215cc731525SEric W. Biederman #define BUS_MCEERR_AO 5 2168a1ab315SDavid Howells #define NSIGBUS 5 2178a1ab315SDavid Howells 2188a1ab315SDavid Howells /* 2198a1ab315SDavid Howells * SIGTRAP si_codes 2208a1ab315SDavid Howells */ 221cc731525SEric W. Biederman #define TRAP_BRKPT 1 /* process breakpoint */ 222cc731525SEric W. Biederman #define TRAP_TRACE 2 /* process trace trap */ 223cc731525SEric W. Biederman #define TRAP_BRANCH 3 /* process taken branch trap */ 224cc731525SEric W. Biederman #define TRAP_HWBKPT 4 /* hardware breakpoint/watchpoint */ 2258a1ab315SDavid Howells #define NSIGTRAP 4 2268a1ab315SDavid Howells 2278a1ab315SDavid Howells /* 2288a1ab315SDavid Howells * SIGCHLD si_codes 2298a1ab315SDavid Howells */ 230cc731525SEric W. Biederman #define CLD_EXITED 1 /* child has exited */ 231cc731525SEric W. Biederman #define CLD_KILLED 2 /* child was killed */ 232cc731525SEric W. Biederman #define CLD_DUMPED 3 /* child terminated abnormally */ 233cc731525SEric W. Biederman #define CLD_TRAPPED 4 /* traced child has trapped */ 234cc731525SEric W. Biederman #define CLD_STOPPED 5 /* child has stopped */ 235cc731525SEric W. Biederman #define CLD_CONTINUED 6 /* stopped child has continued */ 2368a1ab315SDavid Howells #define NSIGCHLD 6 2378a1ab315SDavid Howells 2388a1ab315SDavid Howells /* 239d08477aaSEric W. Biederman * SIGPOLL (or any other signal without signal specific si_codes) si_codes 2408a1ab315SDavid Howells */ 241cc731525SEric W. Biederman #define POLL_IN 1 /* data input available */ 242cc731525SEric W. Biederman #define POLL_OUT 2 /* output buffers available */ 243cc731525SEric W. Biederman #define POLL_MSG 3 /* input message available */ 244cc731525SEric W. Biederman #define POLL_ERR 4 /* i/o error */ 245cc731525SEric W. Biederman #define POLL_PRI 5 /* high priority input available */ 246cc731525SEric W. Biederman #define POLL_HUP 6 /* device disconnected */ 2478a1ab315SDavid Howells #define NSIGPOLL 6 2488a1ab315SDavid Howells 2498a1ab315SDavid Howells /* 2508a1ab315SDavid Howells * SIGSYS si_codes 2518a1ab315SDavid Howells */ 252cc731525SEric W. Biederman #define SYS_SECCOMP 1 /* seccomp triggered */ 2538a1ab315SDavid Howells #define NSIGSYS 1 2548a1ab315SDavid Howells 2558a1ab315SDavid Howells /* 2568a1ab315SDavid Howells * sigevent definitions 2578a1ab315SDavid Howells * 2588a1ab315SDavid Howells * It seems likely that SIGEV_THREAD will have to be handled from 2598a1ab315SDavid Howells * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the 2608a1ab315SDavid Howells * thread manager then catches and does the appropriate nonsense. 2618a1ab315SDavid Howells * However, everything is written out here so as to not get lost. 2628a1ab315SDavid Howells */ 2638a1ab315SDavid Howells #define SIGEV_SIGNAL 0 /* notify via signal */ 2648a1ab315SDavid Howells #define SIGEV_NONE 1 /* other notification: meaningless */ 2658a1ab315SDavid Howells #define SIGEV_THREAD 2 /* deliver via thread creation */ 2668a1ab315SDavid Howells #define SIGEV_THREAD_ID 4 /* deliver to thread */ 2678a1ab315SDavid Howells 2688a1ab315SDavid Howells /* 2698a1ab315SDavid Howells * This works because the alignment is ok on all current architectures 2708a1ab315SDavid Howells * but we leave open this being overridden in the future 2718a1ab315SDavid Howells */ 2728a1ab315SDavid Howells #ifndef __ARCH_SIGEV_PREAMBLE_SIZE 2738a1ab315SDavid Howells #define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t)) 2748a1ab315SDavid Howells #endif 2758a1ab315SDavid Howells 2768a1ab315SDavid Howells #define SIGEV_MAX_SIZE 64 2778a1ab315SDavid Howells #define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \ 2788a1ab315SDavid Howells / sizeof(int)) 2798a1ab315SDavid Howells 2808a1ab315SDavid Howells typedef struct sigevent { 2818a1ab315SDavid Howells sigval_t sigev_value; 2828a1ab315SDavid Howells int sigev_signo; 2838a1ab315SDavid Howells int sigev_notify; 2848a1ab315SDavid Howells union { 2858a1ab315SDavid Howells int _pad[SIGEV_PAD_SIZE]; 2868a1ab315SDavid Howells int _tid; 2878a1ab315SDavid Howells 2888a1ab315SDavid Howells struct { 2898a1ab315SDavid Howells void (*_function)(sigval_t); 2908a1ab315SDavid Howells void *_attribute; /* really pthread_attr_t */ 2918a1ab315SDavid Howells } _sigev_thread; 2928a1ab315SDavid Howells } _sigev_un; 2938a1ab315SDavid Howells } sigevent_t; 2948a1ab315SDavid Howells 2958a1ab315SDavid Howells #define sigev_notify_function _sigev_un._sigev_thread._function 2968a1ab315SDavid Howells #define sigev_notify_attributes _sigev_un._sigev_thread._attribute 2978a1ab315SDavid Howells #define sigev_notify_thread_id _sigev_un._tid 2988a1ab315SDavid Howells 2998a1ab315SDavid Howells 3008a1ab315SDavid Howells #endif /* _UAPI_ASM_GENERIC_SIGINFO_H */ 301