[clang-tidy][NFC]remove deps of clang in clang tidy test (#116588)
[llvm-project.git] / libc / include / llvm-libc-types / siginfo_t.h
blob20fdd461bb6df64a9a3538c294ff6d191c052f99
1 //===-- Definition of siginfo_t type --------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_TYPES_SIGINFO_T_H
10 #define LLVM_LIBC_TYPES_SIGINFO_T_H
12 #include "clock_t.h"
13 #include "pid_t.h"
14 #include "uid_t.h"
15 #include "union_sigval.h"
17 #define SI_MAX_SIZE 128
19 typedef struct {
20 int si_signo; /* Signal number. */
21 int si_errno; /* If non-zero, an errno value associated with
22 this signal, as defined in <errno.h>. */
23 int si_code; /* Signal code. */
24 union {
25 int _si_pad[SI_MAX_SIZE / sizeof(int)];
27 /* kill() */
28 struct {
29 pid_t si_pid; /* sender's pid */
30 uid_t si_uid; /* sender's uid */
31 } _kill;
33 /* POSIX.1b timers */
34 struct {
35 int si_tid; /* timer id */
36 int _overrun; /* overrun count */
37 union sigval si_sigval; /* same as below */
38 } _timer;
40 /* POSIX.1b signals */
41 struct {
42 pid_t si_pid; /* sender's pid */
43 uid_t si_uid; /* sender's uid */
44 union sigval si_sigval;
45 } _rt;
47 /* SIGCHLD */
48 struct {
49 pid_t si_pid; /* which child */
50 uid_t si_uid; /* sender's uid */
51 int si_status; /* exit code */
52 clock_t si_utime;
53 clock_t si_stime;
54 } _sigchld;
56 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */
57 struct {
58 void *si_addr; /* faulting insn/memory ref. */
59 short int si_addr_lsb; /* Valid LSB of the reported address. */
60 union {
61 /* used when si_code=SEGV_BNDERR */
62 struct {
63 void *_lower;
64 void *_upper;
65 } _addr_bnd;
66 /* used when si_code=SEGV_PKUERR */
67 __UINT32_TYPE__ _pkey;
68 } _bounds;
69 } _sigfault;
71 /* SIGPOLL */
72 struct {
73 long int si_band; /* POLL_IN, POLL_OUT, POLL_MSG */
74 int si_fd;
75 } _sigpoll;
77 /* SIGSYS */
78 struct {
79 void *_call_addr; /* calling user insn */
80 int _syscall; /* triggering system call number */
81 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
82 } _sigsys;
83 } _sifields;
84 } siginfo_t;
86 #undef SI_MAX_SIZE
88 #define si_pid _sifields._kill.si_pid
89 #define si_uid _sifields._kill.si_uid
90 #define si_timerid _sifields._timer.si_tid
91 #define si_overrun _sifields._timer.si_overrun
92 #define si_status _sifields._sigchld.si_status
93 #define si_utime _sifields._sigchld.si_utime
94 #define si_stime _sifields._sigchld.si_stime
95 #define si_value _sifields._rt.si_sigval
96 #define si_int _sifields._rt.si_sigval.sival_int
97 #define si_ptr _sifields._rt.si_sigval.sival_ptr
98 #define si_addr _sifields._sigfault.si_addr
99 #define si_addr_lsb _sifields._sigfault.si_addr_lsb
100 #define si_lower _sifields._sigfault._bounds._addr_bnd._lower
101 #define si_upper _sifields._sigfault._bounds._addr_bnd._upper
102 #define si_pkey _sifields._sigfault._bounds._pkey
103 #define si_band _sifields._sigpoll.si_band
104 #define si_fd _sifields._sigpoll.si_fd
105 #define si_call_addr _sifields._sigsys._call_addr
106 #define si_syscall _sifields._sigsys._syscall
107 #define si_arch _sifields._sigsys._arch
109 #endif // LLVM_LIBC_TYPES_SIGINFO_T_H