logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

siginfo.h (10678B)


  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _ASM_GENERIC_SIGINFO_H
  3. #define _ASM_GENERIC_SIGINFO_H
  4. #include <linux/types.h>
  5. typedef union sigval {
  6. int sival_int;
  7. void *sival_ptr;
  8. } sigval_t;
  9. #define SI_MAX_SIZE 128
  10. /*
  11. * The default "si_band" type is "long", as specified by POSIX.
  12. * However, some architectures want to override this to "int"
  13. * for historical compatibility reasons, so we allow that.
  14. */
  15. #ifndef __ARCH_SI_BAND_T
  16. #define __ARCH_SI_BAND_T long
  17. #endif
  18. #ifndef __ARCH_SI_CLOCK_T
  19. #define __ARCH_SI_CLOCK_T __kernel_clock_t
  20. #endif
  21. #ifndef __ARCH_SI_ATTRIBUTES
  22. #define __ARCH_SI_ATTRIBUTES
  23. #endif
  24. /*
  25. * Be careful when extending this union. On 32bit siginfo_t is 32bit
  26. * aligned. Which means that a 64bit field or any other field that
  27. * would increase the alignment of siginfo_t will break the ABI.
  28. */
  29. union __sifields {
  30. /* kill() */
  31. struct {
  32. __kernel_pid_t _pid; /* sender's pid */
  33. __kernel_uid32_t _uid; /* sender's uid */
  34. } _kill;
  35. /* POSIX.1b timers */
  36. struct {
  37. __kernel_timer_t _tid; /* timer id */
  38. int _overrun; /* overrun count */
  39. sigval_t _sigval; /* same as below */
  40. int _sys_private; /* not to be passed to user */
  41. } _timer;
  42. /* POSIX.1b signals */
  43. struct {
  44. __kernel_pid_t _pid; /* sender's pid */
  45. __kernel_uid32_t _uid; /* sender's uid */
  46. sigval_t _sigval;
  47. } _rt;
  48. /* SIGCHLD */
  49. struct {
  50. __kernel_pid_t _pid; /* which child */
  51. __kernel_uid32_t _uid; /* sender's uid */
  52. int _status; /* exit code */
  53. __ARCH_SI_CLOCK_T _utime;
  54. __ARCH_SI_CLOCK_T _stime;
  55. } _sigchld;
  56. /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */
  57. struct {
  58. void *_addr; /* faulting insn/memory ref. */
  59. #define __ADDR_BND_PKEY_PAD (__alignof__(void *) < sizeof(short) ? \
  60. sizeof(short) : __alignof__(void *))
  61. union {
  62. /* used on alpha and sparc */
  63. int _trapno; /* TRAP # which caused the signal */
  64. /*
  65. * used when si_code=BUS_MCEERR_AR or
  66. * used when si_code=BUS_MCEERR_AO
  67. */
  68. short _addr_lsb; /* LSB of the reported address */
  69. /* used when si_code=SEGV_BNDERR */
  70. struct {
  71. char _dummy_bnd[__ADDR_BND_PKEY_PAD];
  72. void *_lower;
  73. void *_upper;
  74. } _addr_bnd;
  75. /* used when si_code=SEGV_PKUERR */
  76. struct {
  77. char _dummy_pkey[__ADDR_BND_PKEY_PAD];
  78. __u32 _pkey;
  79. } _addr_pkey;
  80. /* used when si_code=TRAP_PERF */
  81. struct {
  82. unsigned long _data;
  83. __u32 _type;
  84. __u32 _flags;
  85. } _perf;
  86. };
  87. } _sigfault;
  88. /* SIGPOLL */
  89. struct {
  90. __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  91. int _fd;
  92. } _sigpoll;
  93. /* SIGSYS */
  94. struct {
  95. void *_call_addr; /* calling user insn */
  96. int _syscall; /* triggering system call number */
  97. unsigned int _arch; /* AUDIT_ARCH_* of syscall */
  98. } _sigsys;
  99. };
  100. #ifndef __ARCH_HAS_SWAPPED_SIGINFO
  101. #define __SIGINFO \
  102. struct { \
  103. int si_signo; \
  104. int si_errno; \
  105. int si_code; \
  106. union __sifields _sifields; \
  107. }
  108. #else
  109. #define __SIGINFO \
  110. struct { \
  111. int si_signo; \
  112. int si_code; \
  113. int si_errno; \
  114. union __sifields _sifields; \
  115. }
  116. #endif /* __ARCH_HAS_SWAPPED_SIGINFO */
  117. typedef struct siginfo {
  118. union {
  119. __SIGINFO;
  120. int _si_pad[SI_MAX_SIZE/sizeof(int)];
  121. };
  122. } __ARCH_SI_ATTRIBUTES siginfo_t;
  123. /*
  124. * How these fields are to be accessed.
  125. */
  126. #define si_pid _sifields._kill._pid
  127. #define si_uid _sifields._kill._uid
  128. #define si_tid _sifields._timer._tid
  129. #define si_overrun _sifields._timer._overrun
  130. #define si_sys_private _sifields._timer._sys_private
  131. #define si_status _sifields._sigchld._status
  132. #define si_utime _sifields._sigchld._utime
  133. #define si_stime _sifields._sigchld._stime
  134. #define si_value _sifields._rt._sigval
  135. #define si_int _sifields._rt._sigval.sival_int
  136. #define si_ptr _sifields._rt._sigval.sival_ptr
  137. #define si_addr _sifields._sigfault._addr
  138. #define si_trapno _sifields._sigfault._trapno
  139. #define si_addr_lsb _sifields._sigfault._addr_lsb
  140. #define si_lower _sifields._sigfault._addr_bnd._lower
  141. #define si_upper _sifields._sigfault._addr_bnd._upper
  142. #define si_pkey _sifields._sigfault._addr_pkey._pkey
  143. #define si_perf_data _sifields._sigfault._perf._data
  144. #define si_perf_type _sifields._sigfault._perf._type
  145. #define si_perf_flags _sifields._sigfault._perf._flags
  146. #define si_band _sifields._sigpoll._band
  147. #define si_fd _sifields._sigpoll._fd
  148. #define si_call_addr _sifields._sigsys._call_addr
  149. #define si_syscall _sifields._sigsys._syscall
  150. #define si_arch _sifields._sigsys._arch
  151. /*
  152. * si_code values
  153. * Digital reserves positive values for kernel-generated signals.
  154. */
  155. #define SI_USER 0 /* sent by kill, sigsend, raise */
  156. #define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
  157. #define SI_QUEUE -1 /* sent by sigqueue */
  158. #define SI_TIMER -2 /* sent by timer expiration */
  159. #define SI_MESGQ -3 /* sent by real time mesq state change */
  160. #define SI_ASYNCIO -4 /* sent by AIO completion */
  161. #define SI_SIGIO -5 /* sent by queued SIGIO */
  162. #define SI_TKILL -6 /* sent by tkill system call */
  163. #define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */
  164. #define SI_ASYNCNL -60 /* sent by glibc async name lookup completion */
  165. #define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
  166. #define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
  167. /*
  168. * SIGILL si_codes
  169. */
  170. #define ILL_ILLOPC 1 /* illegal opcode */
  171. #define ILL_ILLOPN 2 /* illegal operand */
  172. #define ILL_ILLADR 3 /* illegal addressing mode */
  173. #define ILL_ILLTRP 4 /* illegal trap */
  174. #define ILL_PRVOPC 5 /* privileged opcode */
  175. #define ILL_PRVREG 6 /* privileged register */
  176. #define ILL_COPROC 7 /* coprocessor error */
  177. #define ILL_BADSTK 8 /* internal stack error */
  178. #define ILL_BADIADDR 9 /* unimplemented instruction address */
  179. #define __ILL_BREAK 10 /* illegal break */
  180. #define __ILL_BNDMOD 11 /* bundle-update (modification) in progress */
  181. #define NSIGILL 11
  182. /*
  183. * SIGFPE si_codes
  184. */
  185. #define FPE_INTDIV 1 /* integer divide by zero */
  186. #define FPE_INTOVF 2 /* integer overflow */
  187. #define FPE_FLTDIV 3 /* floating point divide by zero */
  188. #define FPE_FLTOVF 4 /* floating point overflow */
  189. #define FPE_FLTUND 5 /* floating point underflow */
  190. #define FPE_FLTRES 6 /* floating point inexact result */
  191. #define FPE_FLTINV 7 /* floating point invalid operation */
  192. #define FPE_FLTSUB 8 /* subscript out of range */
  193. #define __FPE_DECOVF 9 /* decimal overflow */
  194. #define __FPE_DECDIV 10 /* decimal division by zero */
  195. #define __FPE_DECERR 11 /* packed decimal error */
  196. #define __FPE_INVASC 12 /* invalid ASCII digit */
  197. #define __FPE_INVDEC 13 /* invalid decimal digit */
  198. #define FPE_FLTUNK 14 /* undiagnosed floating-point exception */
  199. #define FPE_CONDTRAP 15 /* trap on condition */
  200. #define NSIGFPE 15
  201. /*
  202. * SIGSEGV si_codes
  203. */
  204. #define SEGV_MAPERR 1 /* address not mapped to object */
  205. #define SEGV_ACCERR 2 /* invalid permissions for mapped object */
  206. #define SEGV_BNDERR 3 /* failed address bound checks */
  207. #ifdef __ia64__
  208. # define __SEGV_PSTKOVF 4 /* paragraph stack overflow */
  209. #else
  210. # define SEGV_PKUERR 4 /* failed protection key checks */
  211. #endif
  212. #define SEGV_ACCADI 5 /* ADI not enabled for mapped object */
  213. #define SEGV_ADIDERR 6 /* Disrupting MCD error */
  214. #define SEGV_ADIPERR 7 /* Precise MCD exception */
  215. #define SEGV_MTEAERR 8 /* Asynchronous ARM MTE error */
  216. #define SEGV_MTESERR 9 /* Synchronous ARM MTE exception */
  217. #define SEGV_CPERR 10 /* Control protection fault */
  218. #define NSIGSEGV 10
  219. /*
  220. * SIGBUS si_codes
  221. */
  222. #define BUS_ADRALN 1 /* invalid address alignment */
  223. #define BUS_ADRERR 2 /* non-existent physical address */
  224. #define BUS_OBJERR 3 /* object specific hardware error */
  225. /* hardware memory error consumed on a machine check: action required */
  226. #define BUS_MCEERR_AR 4
  227. /* hardware memory error detected in process but not consumed: action optional*/
  228. #define BUS_MCEERR_AO 5
  229. #define NSIGBUS 5
  230. /*
  231. * SIGTRAP si_codes
  232. */
  233. #define TRAP_BRKPT 1 /* process breakpoint */
  234. #define TRAP_TRACE 2 /* process trace trap */
  235. #define TRAP_BRANCH 3 /* process taken branch trap */
  236. #define TRAP_HWBKPT 4 /* hardware breakpoint/watchpoint */
  237. #define TRAP_UNK 5 /* undiagnosed trap */
  238. #define TRAP_PERF 6 /* perf event with sigtrap=1 */
  239. #define NSIGTRAP 6
  240. /*
  241. * There is an additional set of SIGTRAP si_codes used by ptrace
  242. * that are of the form: ((PTRACE_EVENT_XXX << 8) | SIGTRAP)
  243. */
  244. /*
  245. * Flags for si_perf_flags if SIGTRAP si_code is TRAP_PERF.
  246. */
  247. #define TRAP_PERF_FLAG_ASYNC (1u << 0)
  248. /*
  249. * SIGCHLD si_codes
  250. */
  251. #define CLD_EXITED 1 /* child has exited */
  252. #define CLD_KILLED 2 /* child was killed */
  253. #define CLD_DUMPED 3 /* child terminated abnormally */
  254. #define CLD_TRAPPED 4 /* traced child has trapped */
  255. #define CLD_STOPPED 5 /* child has stopped */
  256. #define CLD_CONTINUED 6 /* stopped child has continued */
  257. #define NSIGCHLD 6
  258. /*
  259. * SIGPOLL (or any other signal without signal specific si_codes) si_codes
  260. */
  261. #define POLL_IN 1 /* data input available */
  262. #define POLL_OUT 2 /* output buffers available */
  263. #define POLL_MSG 3 /* input message available */
  264. #define POLL_ERR 4 /* i/o error */
  265. #define POLL_PRI 5 /* high priority input available */
  266. #define POLL_HUP 6 /* device disconnected */
  267. #define NSIGPOLL 6
  268. /*
  269. * SIGSYS si_codes
  270. */
  271. #define SYS_SECCOMP 1 /* seccomp triggered */
  272. #define SYS_USER_DISPATCH 2 /* syscall user dispatch triggered */
  273. #define NSIGSYS 2
  274. /*
  275. * SIGEMT si_codes
  276. */
  277. #define EMT_TAGOVF 1 /* tag overflow */
  278. #define NSIGEMT 1
  279. /*
  280. * sigevent definitions
  281. *
  282. * It seems likely that SIGEV_THREAD will have to be handled from
  283. * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
  284. * thread manager then catches and does the appropriate nonsense.
  285. * However, everything is written out here so as to not get lost.
  286. */
  287. #define SIGEV_SIGNAL 0 /* notify via signal */
  288. #define SIGEV_NONE 1 /* other notification: meaningless */
  289. #define SIGEV_THREAD 2 /* deliver via thread creation */
  290. #define SIGEV_THREAD_ID 4 /* deliver to thread */
  291. /*
  292. * This works because the alignment is ok on all current architectures
  293. * but we leave open this being overridden in the future
  294. */
  295. #ifndef __ARCH_SIGEV_PREAMBLE_SIZE
  296. #define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t))
  297. #endif
  298. #define SIGEV_MAX_SIZE 64
  299. #define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \
  300. / sizeof(int))
  301. typedef struct sigevent {
  302. sigval_t sigev_value;
  303. int sigev_signo;
  304. int sigev_notify;
  305. union {
  306. int _pad[SIGEV_PAD_SIZE];
  307. int _tid;
  308. struct {
  309. void (*_function)(sigval_t);
  310. void *_attribute; /* really pthread_attr_t */
  311. } _sigev_thread;
  312. } _sigev_un;
  313. } sigevent_t;
  314. #define sigev_notify_function _sigev_un._sigev_thread._function
  315. #define sigev_notify_attributes _sigev_un._sigev_thread._attribute
  316. #define sigev_notify_thread_id _sigev_un._tid
  317. #endif /* _ASM_GENERIC_SIGINFO_H */