/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 2004 Tim J. Robbins4* Copyright (c) 2001 Doug Rabson5* Copyright (c) 1994-1996 Søren Schmidt6* All rights reserved.7* Copyright (c) 2022 Dmitry Chagin <[email protected]>8*9* Redistribution and use in source and binary forms, with or without10* modification, are permitted provided that the following conditions11* are met:12* 1. Redistributions of source code must retain the above copyright13* notice, this list of conditions and the following disclaimer14* in this position and unchanged.15* 2. Redistributions in binary form must reproduce the above copyright16* notice, this list of conditions and the following disclaimer in the17* documentation and/or other materials provided with the distribution.18* 3. The name of the author may not be used to endorse or promote products19* derived from this software without specific prior written permission20*21* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR22* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES23* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.24* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,25* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT26* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,27* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY28* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT29* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF30* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.31*/3233#ifndef _LINUX_SIGINFO_H_34#define _LINUX_SIGINFO_H_3536/*37* si_code values38*/39#define LINUX_SI_USER 0 /* sent by kill, sigsend, raise */40#define LINUX_SI_KERNEL 0x80 /* sent by the kernel from somewhere */41#define LINUX_SI_QUEUE -1 /* sent by sigqueue */42#define LINUX_SI_TIMER -2 /* sent by timer expiration */43#define LINUX_SI_MESGQ -3 /* sent by real time mesq state change */44#define LINUX_SI_ASYNCIO -4 /* sent by AIO completion */45#define LINUX_SI_SIGIO -5 /* sent by queued SIGIO */46#define LINUX_SI_TKILL -6 /* sent by tkill system call */4748/*49* SIGILL si_codes50*/51#define LINUX_ILL_ILLOPC 1 /* illegal opcode */52#define LINUX_ILL_ILLOPN 2 /* illegal operand */53#define LINUX_ILL_ILLADR 3 /* illegal addressing mode */54#define LINUX_ILL_ILLTRP 4 /* illegal trap */55#define LINUX_ILL_PRVOPC 5 /* privileged opcode */56#define LINUX_ILL_PRVREG 6 /* privileged register */57#define LINUX_ILL_COPROC 7 /* coprocessor error */58#define LINUX_ILL_BADSTK 8 /* internal stack error */59#define LINUX_ILL_BADIADDR 9 /* unimplemented instruction address */60#define LINUX___ILL_BREAK 10 /* (ia64) illegal break */61#define LINUX___ILL_BNDMOD 11 /* (ia64) bundle-update (modification)62* in progress63*/6465/*66* SIGFPE si_codes67*/68#define LINUX_FPE_INTDIV 1 /* integer divide by zero */69#define LINUX_FPE_INTOVF 2 /* integer overflow */70#define LINUX_FPE_FLTDIV 3 /* floating point divide by zero */71#define LINUX_FPE_FLTOVF 4 /* floating point overflow */72#define LINUX_FPE_FLTUND 5 /* floating point underflow */73#define LINUX_FPE_FLTRES 6 /* floating point inexact result */74#define LINUX_FPE_FLTINV 7 /* floating point invalid operation */75#define LINUX_FPE_FLTSUB 8 /* (ia64) subscript out of range */76#define LINUX___FPE_DECOVF 9 /* (ia64) decimal overflow */77#define LINUX___FPE_DECDIV 10 /* (ia64) decimal division by zero */78#define LINUX___FPE_DECERR 11 /* (ia64) packed decimal error */79#define LINUX___FPE_INVASC 12 /* (ia64) invalid ASCII digit */80#define LINUX___FPE_INVDEC 13 /* (ia64) invalid decimal digit */81#define LINUX_FPE_FLTUNK 14 /* undiagnosed floating-point exception */82#define LINUX_FPE_CONDTRAP 15 /* trap on condition */8384/*85* SIGSEGV si_codes86*/87#define LINUX_SEGV_MAPERR 1 /* address not mapped to object */88#define LINUX_SEGV_ACCERR 2 /* invalid permissions for mapped object */89#define LINUX_SEGV_BNDERR 3 /* failed address bound checks */90#ifdef __ia64__91#define LINUX___SEGV_PSTKOVF 4 /* paragraph stack overflow */92#else93#define LINUX_SEGV_PKUERR 4 /* failed protection key checks */94#endif95#define LINUX_SEGV_ACCADI 5 /* ADI not enabled for mapped object */96#define LINUX_SEGV_ADIDERR 6 /* Disrupting MCD error */97#define LINUX_SEGV_ADIPERR 7 /* Precise MCD exception */98#define LINUX_SEGV_MTEAERR 8 /* Asynchronous ARM MTE error */99#define LINUX_SEGV_MTESERR 9 /* Synchronous ARM MTE exception */100101/*102* SIGBUS si_codes103*/104#define LINUX_BUS_ADRALN 1 /* invalid address alignment */105#define LINUX_BUS_ADRERR 2 /* non-existent physical address */106#define LINUX_BUS_OBJERR 3 /* object specific hardware error */107108#define LINUX_BUS_MCEERR_AR 4 /* hardware memory error consumed109* on a machine check:110* action required111*/112#define LINUX_BUS_MCEERR_AO 5 /* hardware memory error detected113* in process but not consumed:114* action optional115*/116117/*118* SIGTRAP si_codes119*/120#define LINUX_TRAP_BRKPT 1 /* process breakpoint */121#define LINUX_TRAP_TRACE 2 /* process trace trap */122#define LINUX_TRAP_BRANCH 3 /* process taken branch trap */123#define LINUX_TRAP_HWBKPT 4 /* hardware breakpoint/watchpoint */124#define LINUX_TRAP_UNK 5 /* undiagnosed trap */125#define LINUX_TRAP_PERF 6 /* perf event with sigtrap=1 */126127/*128* SIGCHLD si_codes129*/130#define LINUX_CLD_EXITED 1 /* child has exited */131#define LINUX_CLD_KILLED 2 /* child was killed */132#define LINUX_CLD_DUMPED 3 /* child terminated abnormally */133#define LINUX_CLD_TRAPPED 4 /* traced child has trapped */134#define LINUX_CLD_STOPPED 5 /* child has stopped */135#define LINUX_CLD_CONTINUED 6 /* stopped child has continued */136137/*138* SIGPOLL (or any other signal without signal specific si_codes) si_codes139*/140#define LINUX_POLL_IN 1 /* data input available */141#define LINUX_POLL_OUT 2 /* output buffers available */142#define LINUX_POLL_MSG 3 /* input message available */143#define LINUX_POLL_ERR 4 /* i/o error */144#define LINUX_POLL_PRI 5 /* high priority input available */145#define LINUX_POLL_HUP 6 /* device disconnected */146147/*148* SIGSYS si_codes149*/150#define LINUX_SYS_SECCOMP 1 /* seccomp triggered */151#define LINUX_SYS_USER_DISPATCH 2 /* syscall user dispatch triggered */152153/*154* SIGEMT si_codes155*/156#define LINUX_EMT_TAGOVF 1 /* tag overflow */157158typedef union l_sigval {159l_int sival_int;160l_uintptr_t sival_ptr;161} l_sigval_t;162163#define LINUX_SI_MAX_SIZE 128164165union __sifields {166struct {167l_pid_t _pid;168l_uid_t _uid;169} _kill;170171struct {172l_timer_t _tid;173l_int _overrun;174char _pad[sizeof(l_uid_t) - sizeof(int)];175union l_sigval _sigval;176l_uint _sys_private;177} _timer;178179struct {180l_pid_t _pid; /* sender's pid */181l_uid_t _uid; /* sender's uid */182union l_sigval _sigval;183} _rt;184185struct {186l_pid_t _pid; /* which child */187l_uid_t _uid; /* sender's uid */188l_int _status; /* exit code */189l_clock_t _utime;190l_clock_t _stime;191} _sigchld;192193struct {194l_uintptr_t _addr; /* Faulting insn/memory ref. */195} _sigfault;196197struct {198l_long _band; /* POLL_IN,POLL_OUT,POLL_MSG */199l_int _fd;200} _sigpoll;201};202203typedef struct l_siginfo {204union {205struct {206l_int lsi_signo;207l_int lsi_errno;208l_int lsi_code;209union __sifields _sifields;210};211l_int _pad[LINUX_SI_MAX_SIZE/sizeof(l_int)];212};213} l_siginfo_t;214215_Static_assert(sizeof(l_siginfo_t) == LINUX_SI_MAX_SIZE, "l_siginfo_t size");216217#define lsi_pid _sifields._kill._pid218#define lsi_uid _sifields._kill._uid219#define lsi_tid _sifields._timer._tid220#define lsi_overrun _sifields._timer._overrun221#define lsi_sys_private _sifields._timer._sys_private222#define lsi_status _sifields._sigchld._status223#define lsi_utime _sifields._sigchld._utime224#define lsi_stime _sifields._sigchld._stime225#define lsi_value _sifields._rt._sigval226#define lsi_int _sifields._rt._sigval.sival_int227#define lsi_ptr _sifields._rt._sigval.sival_ptr228#define lsi_addr _sifields._sigfault._addr229#define lsi_band _sifields._sigpoll._band230#define lsi_fd _sifields._sigpoll._fd231232#endif /* _LINUX_SIGINFO_H_ */233234235236