siginfo-consts.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. //
  2. // Copyright 2026 Aarav Ravindra Kharade
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. /* siginfo constants. Linux version.
  17. Copyright (C) 1997-2026 Free Software Foundation, Inc.
  18. This file is part of the GNU C Library.
  19. The GNU C Library is free software; you can redistribute it and/or
  20. modify it under the terms of the GNU Lesser General Public
  21. License as published by the Free Software Foundation; either
  22. version 2.1 of the License, or (at your option) any later version.
  23. The GNU C Library is distributed in the hope that it will be useful,
  24. but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  26. Lesser General Public License for more details.
  27. You should have received a copy of the GNU Lesser General Public
  28. License along with the GNU C Library; if not, see
  29. <https://www.gnu.org/licenses/>. */
  30. #ifndef _BITS_SIGINFO_CONSTS_H
  31. #define _BITS_SIGINFO_CONSTS_H 1
  32. #ifndef _SIGNAL_H
  33. #error "Don't include <bits/siginfo-consts.h> directly; use <signal.h> instead."
  34. #endif
  35. /* Most of these constants are uniform across all architectures, but there
  36. is one exception. */
  37. #include <bits/siginfo-arch.h>
  38. #ifndef __SI_ASYNCIO_AFTER_SIGIO
  39. # define __SI_ASYNCIO_AFTER_SIGIO 1
  40. #endif
  41. /* Values for `si_code'. Positive values are reserved for kernel-generated
  42. signals. */
  43. enum
  44. {
  45. SI_ASYNCNL = -60, /* Sent by asynch name lookup completion. */
  46. SI_DETHREAD = -7, /* Sent by execve killing subsidiary
  47. threads. */
  48. SI_TKILL, /* Sent by tkill. */
  49. SI_SIGIO, /* Sent by queued SIGIO. */
  50. #if __SI_ASYNCIO_AFTER_SIGIO
  51. SI_ASYNCIO, /* Sent by AIO completion. */
  52. SI_MESGQ, /* Sent by real time mesq state change. */
  53. SI_TIMER, /* Sent by timer expiration. */
  54. #else
  55. SI_MESGQ,
  56. SI_TIMER,
  57. SI_ASYNCIO,
  58. #endif
  59. SI_QUEUE, /* Sent by sigqueue. */
  60. SI_USER, /* Sent by kill, sigsend. */
  61. SI_KERNEL = 0x80 /* Send by kernel. */
  62. #define SI_ASYNCNL SI_ASYNCNL
  63. #define SI_DETHREAD SI_DETHREAD
  64. #define SI_TKILL SI_TKILL
  65. #define SI_SIGIO SI_SIGIO
  66. #define SI_ASYNCIO SI_ASYNCIO
  67. #define SI_MESGQ SI_MESGQ
  68. #define SI_TIMER SI_TIMER
  69. #define SI_ASYNCIO SI_ASYNCIO
  70. #define SI_QUEUE SI_QUEUE
  71. #define SI_USER SI_USER
  72. #define SI_KERNEL SI_KERNEL
  73. };
  74. # if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
  75. /* `si_code' values for SIGILL signal. */
  76. enum
  77. {
  78. ILL_ILLOPC = 1, /* Illegal opcode. */
  79. # define ILL_ILLOPC ILL_ILLOPC
  80. ILL_ILLOPN, /* Illegal operand. */
  81. # define ILL_ILLOPN ILL_ILLOPN
  82. ILL_ILLADR, /* Illegal addressing mode. */
  83. # define ILL_ILLADR ILL_ILLADR
  84. ILL_ILLTRP, /* Illegal trap. */
  85. # define ILL_ILLTRP ILL_ILLTRP
  86. ILL_PRVOPC, /* Privileged opcode. */
  87. # define ILL_PRVOPC ILL_PRVOPC
  88. ILL_PRVREG, /* Privileged register. */
  89. # define ILL_PRVREG ILL_PRVREG
  90. ILL_COPROC, /* Coprocessor error. */
  91. # define ILL_COPROC ILL_COPROC
  92. ILL_BADSTK, /* Internal stack error. */
  93. # define ILL_BADSTK ILL_BADSTK
  94. ILL_BADIADDR /* Unimplemented instruction address. */
  95. # define ILL_BADIADDR ILL_BADIADDR
  96. };
  97. /* `si_code' values for SIGFPE signal. */
  98. enum
  99. {
  100. FPE_INTDIV = 1, /* Integer divide by zero. */
  101. # define FPE_INTDIV FPE_INTDIV
  102. FPE_INTOVF, /* Integer overflow. */
  103. # define FPE_INTOVF FPE_INTOVF
  104. FPE_FLTDIV, /* Floating point divide by zero. */
  105. # define FPE_FLTDIV FPE_FLTDIV
  106. FPE_FLTOVF, /* Floating point overflow. */
  107. # define FPE_FLTOVF FPE_FLTOVF
  108. FPE_FLTUND, /* Floating point underflow. */
  109. # define FPE_FLTUND FPE_FLTUND
  110. FPE_FLTRES, /* Floating point inexact result. */
  111. # define FPE_FLTRES FPE_FLTRES
  112. FPE_FLTINV, /* Floating point invalid operation. */
  113. # define FPE_FLTINV FPE_FLTINV
  114. FPE_FLTSUB, /* Subscript out of range. */
  115. # define FPE_FLTSUB FPE_FLTSUB
  116. FPE_FLTUNK = 14, /* Undiagnosed floating-point exception. */
  117. # define FPE_FLTUNK FPE_FLTUNK
  118. FPE_CONDTRAP /* Trap on condition. */
  119. # define FPE_CONDTRAP FPE_CONDTRAP
  120. };
  121. /* `si_code' values for SIGSEGV signal. */
  122. enum
  123. {
  124. SEGV_MAPERR = 1, /* Address not mapped to object. */
  125. # define SEGV_MAPERR SEGV_MAPERR
  126. SEGV_ACCERR, /* Invalid permissions for mapped object. */
  127. # define SEGV_ACCERR SEGV_ACCERR
  128. SEGV_BNDERR, /* Bounds checking failure. */
  129. # define SEGV_BNDERR SEGV_BNDERR
  130. SEGV_PKUERR, /* Protection key checking failure. */
  131. # define SEGV_PKUERR SEGV_PKUERR
  132. SEGV_ACCADI, /* ADI not enabled for mapped object. */
  133. # define SEGV_ACCADI SEGV_ACCADI
  134. SEGV_ADIDERR, /* Disrupting MCD error. */
  135. # define SEGV_ADIDERR SEGV_ADIDERR
  136. SEGV_ADIPERR, /* Precise MCD exception. */
  137. # define SEGV_ADIPERR SEGV_ADIPERR
  138. SEGV_MTEAERR, /* Asynchronous ARM MTE error. */
  139. # define SEGV_MTEAERR SEGV_MTEAERR
  140. SEGV_MTESERR, /* Synchronous ARM MTE exception. */
  141. # define SEGV_MTESERR SEGV_MTESERR
  142. SEGV_CPERR /* Control protection fault. */
  143. # define SEGV_CPERR SEGV_CPERR
  144. };
  145. /* `si_code' values for SIGBUS signal. */
  146. enum
  147. {
  148. BUS_ADRALN = 1, /* Invalid address alignment. */
  149. # define BUS_ADRALN BUS_ADRALN
  150. BUS_ADRERR, /* Non-existent physical address. */
  151. # define BUS_ADRERR BUS_ADRERR
  152. BUS_OBJERR, /* Object specific hardware error. */
  153. # define BUS_OBJERR BUS_OBJERR
  154. BUS_MCEERR_AR, /* Hardware memory error: action required. */
  155. # define BUS_MCEERR_AR BUS_MCEERR_AR
  156. BUS_MCEERR_AO /* Hardware memory error: action optional. */
  157. # define BUS_MCEERR_AO BUS_MCEERR_AO
  158. };
  159. # endif
  160. # ifdef __USE_XOPEN_EXTENDED
  161. /* `si_code' values for SIGTRAP signal. */
  162. enum
  163. {
  164. TRAP_BRKPT = 1, /* Process breakpoint. */
  165. # define TRAP_BRKPT TRAP_BRKPT
  166. TRAP_TRACE, /* Process trace trap. */
  167. # define TRAP_TRACE TRAP_TRACE
  168. TRAP_BRANCH, /* Process taken branch trap. */
  169. # define TRAP_BRANCH TRAP_BRANCH
  170. TRAP_HWBKPT, /* Hardware breakpoint/watchpoint. */
  171. # define TRAP_HWBKPT TRAP_HWBKPT
  172. TRAP_UNK, /* Undiagnosed trap. */
  173. # define TRAP_UNK TRAP_UNK
  174. TRAP_PERF /* Perf event with sigtrap=1. */
  175. # define TRAP_PERF TRAP_PERF
  176. };
  177. # endif
  178. # if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
  179. /* `si_code' values for SIGCHLD signal. */
  180. enum
  181. {
  182. CLD_EXITED = 1, /* Child has exited. */
  183. # define CLD_EXITED CLD_EXITED
  184. CLD_KILLED, /* Child was killed. */
  185. # define CLD_KILLED CLD_KILLED
  186. CLD_DUMPED, /* Child terminated abnormally. */
  187. # define CLD_DUMPED CLD_DUMPED
  188. CLD_TRAPPED, /* Traced child has trapped. */
  189. # define CLD_TRAPPED CLD_TRAPPED
  190. CLD_STOPPED, /* Child has stopped. */
  191. # define CLD_STOPPED CLD_STOPPED
  192. CLD_CONTINUED /* Stopped child has continued. */
  193. # define CLD_CONTINUED CLD_CONTINUED
  194. };
  195. /* `si_code' values for SIGPOLL signal. */
  196. enum
  197. {
  198. POLL_IN = 1, /* Data input available. */
  199. # define POLL_IN POLL_IN
  200. POLL_OUT, /* Output buffers available. */
  201. # define POLL_OUT POLL_OUT
  202. POLL_MSG, /* Input message available. */
  203. # define POLL_MSG POLL_MSG
  204. POLL_ERR, /* I/O error. */
  205. # define POLL_ERR POLL_ERR
  206. POLL_PRI, /* High priority input available. */
  207. # define POLL_PRI POLL_PRI
  208. POLL_HUP /* Device disconnected. */
  209. # define POLL_HUP POLL_HUP
  210. };
  211. # endif
  212. /* The Linux-specific SIGSYS values are all considered GNU extensions. */
  213. #ifdef __USE_GNU
  214. /* `si_code' values for SIGSYS signal. */
  215. enum
  216. {
  217. SYS_SECCOMP = 1, /* Seccomp triggered. */
  218. # define SYS_SECCOMP SYS_SECCOMP
  219. SYS_USER_DISPATCH /* Syscall user dispatch triggered. */
  220. # define SYS_USER_DISPATCH SYS_USER_DISPATCH
  221. };
  222. #endif
  223. /* Architectures might also add architecture-specific constants.
  224. These are all considered GNU extensions. */
  225. #ifdef __USE_GNU
  226. # include <bits/siginfo-consts-arch.h>
  227. #endif
  228. #endif