blob: 45d4e4c180e5bd1e6e5f4c5f6b19b0390ebf1cd1 [file] [log] [blame]
Elliott Hughes13da6002025-02-03 10:42:13 -08001// Copyright (C) 2017 The Android Open Source Project
2// SPDX-License-Identifier: BSD-2-Clause
Elliott Hughes21b56eb2017-10-20 17:57:17 -07003
4#include <signal.h>
5
6#include "header_checks.h"
7
8static void signal_h() {
9 void (*h)(int);
10 h = SIG_DFL;
11 h = SIG_ERR;
12 h = SIG_HOLD;
13 h = SIG_IGN;
14
15 TYPE(pthread_t);
16 TYPE(size_t);
17 TYPE(uid_t);
18
19 TYPE(struct timespec);
20
21 TYPE(sig_atomic_t);
22 TYPE(pid_t);
23
24 TYPE(pthread_attr_t);
25
26 TYPE(struct sigevent);
27 STRUCT_MEMBER(struct sigevent, int, sigev_notify);
28 STRUCT_MEMBER(struct sigevent, int, sigev_signo);
29 STRUCT_MEMBER(struct sigevent, union sigval, sigev_value);
30 STRUCT_MEMBER_FUNCTION_POINTER(struct sigevent, void (*f)(union sigval), sigev_notify_function);
George Burgess IV08fd0722019-01-15 19:00:11 -080031#if defined(__BIONIC__)
Elliott Hughes21b56eb2017-10-20 17:57:17 -070032 STRUCT_MEMBER(struct sigevent, void*, sigev_notify_attributes);
33#else
34 STRUCT_MEMBER(struct sigevent, pthread_attr_t*, sigev_notify_attributes);
35#endif
36
37 MACRO(SIGEV_NONE);
38 MACRO(SIGEV_SIGNAL);
39 MACRO(SIGEV_THREAD);
40
Elliott Hughes55c1e372024-08-08 19:37:14 +000041#if !defined(__GLIBC__) // Our glibc is too old.
42 MACRO(SIG2STR_MAX);
43#endif
44
Elliott Hughes21b56eb2017-10-20 17:57:17 -070045 TYPE(union sigval);
46 STRUCT_MEMBER(union sigval, int, sival_int);
47 STRUCT_MEMBER(union sigval, void*, sival_ptr);
48
49 int i;
50 i = SIGRTMIN;
51 i = SIGRTMAX;
52
Elliott Hughesf4d57ac2025-01-28 14:22:12 -080053#if !defined(__GLIBC__) // Our glibc is too old.
54 MACRO(SIG2STR_MAX);
55#endif
56
Elliott Hughes21b56eb2017-10-20 17:57:17 -070057 MACRO(SIGABRT);
58 MACRO(SIGALRM);
59 MACRO(SIGBUS);
60 MACRO(SIGCHLD);
61 MACRO(SIGCONT);
62 MACRO(SIGFPE);
63 MACRO(SIGHUP);
64 MACRO(SIGILL);
65 MACRO(SIGINT);
66 MACRO(SIGKILL);
67 MACRO(SIGPIPE);
68 MACRO(SIGQUIT);
69 MACRO(SIGSEGV);
70 MACRO(SIGSTOP);
71 MACRO(SIGTERM);
72 MACRO(SIGTSTP);
73 MACRO(SIGTTIN);
74 MACRO(SIGTTOU);
75 MACRO(SIGUSR1);
76 MACRO(SIGUSR2);
77 MACRO(SIGPOLL);
78 MACRO(SIGPROF);
79 MACRO(SIGSYS);
80 MACRO(SIGTRAP);
81 MACRO(SIGURG);
82 MACRO(SIGVTALRM);
83 MACRO(SIGXCPU);
84 MACRO(SIGXFSZ);
85
86 TYPE(struct sigaction);
87 STRUCT_MEMBER_FUNCTION_POINTER(struct sigaction, void (*f)(int), sa_handler);
88 STRUCT_MEMBER(struct sigaction, sigset_t, sa_mask);
Elliott Hughes21b56eb2017-10-20 17:57:17 -070089 STRUCT_MEMBER(struct sigaction, int, sa_flags);
Elliott Hughes21b56eb2017-10-20 17:57:17 -070090 STRUCT_MEMBER_FUNCTION_POINTER(struct sigaction, void (*f)(int, siginfo_t*, void*), sa_sigaction);
91
92 i = SIG_BLOCK;
93 i = SIG_UNBLOCK;
94 i = SIG_SETMASK;
95
96 MACRO(SA_NOCLDSTOP);
97 MACRO(SA_ONSTACK);
98 MACRO(SA_RESETHAND);
99 MACRO(SA_RESTART);
100 MACRO(SA_SIGINFO);
101 MACRO(SA_NOCLDWAIT);
102 MACRO(SA_NODEFER);
103
104 MACRO(SS_ONSTACK);
105 MACRO(SS_DISABLE);
106
107 MACRO(MINSIGSTKSZ);
108 MACRO(SIGSTKSZ);
109
110 TYPE(mcontext_t);
111
112 TYPE(ucontext_t);
113 STRUCT_MEMBER(ucontext_t, ucontext_t*, uc_link);
114 STRUCT_MEMBER(ucontext_t, sigset_t, uc_sigmask);
115 STRUCT_MEMBER(ucontext_t, stack_t, uc_stack);
116 STRUCT_MEMBER(ucontext_t, mcontext_t, uc_mcontext);
117
118 TYPE(stack_t);
119 STRUCT_MEMBER(stack_t, void*, ss_sp);
120 STRUCT_MEMBER(stack_t, size_t, ss_size);
121 STRUCT_MEMBER(stack_t, int, ss_flags);
122
123 TYPE(siginfo_t);
124 STRUCT_MEMBER(siginfo_t, int, si_signo);
125 STRUCT_MEMBER(siginfo_t, int, si_code);
126 STRUCT_MEMBER(siginfo_t, int, si_errno);
127 STRUCT_MEMBER(siginfo_t, pid_t, si_pid);
128 STRUCT_MEMBER(siginfo_t, uid_t, si_uid);
129 STRUCT_MEMBER(siginfo_t, void*, si_addr);
130 STRUCT_MEMBER(siginfo_t, int, si_status);
131 STRUCT_MEMBER(siginfo_t, long, si_band);
132 STRUCT_MEMBER(siginfo_t, union sigval, si_value);
133
134 i = ILL_ILLOPC;
135 i = ILL_ILLOPN;
136 i = ILL_ILLADR;
137 i = ILL_ILLTRP;
138 i = ILL_PRVOPC;
139 i = ILL_PRVREG;
140 i = ILL_COPROC;
141 i = ILL_BADSTK;
142
143 i = FPE_INTDIV;
144 i = FPE_INTOVF;
145 i = FPE_FLTDIV;
146 i = FPE_FLTOVF;
147 i = FPE_FLTUND;
148 i = FPE_FLTRES;
149 i = FPE_FLTINV;
150 i = FPE_FLTSUB;
151
152 i = SEGV_MAPERR;
153 i = SEGV_ACCERR;
154
155 i = BUS_ADRALN;
156 i = BUS_ADRERR;
157 i = BUS_OBJERR;
158
159 i = TRAP_BRKPT;
160 i = TRAP_TRACE;
161
162 i = CLD_EXITED;
163 i = CLD_KILLED;
164 i = CLD_DUMPED;
165 i = CLD_TRAPPED;
166 i = CLD_STOPPED;
167 i = CLD_CONTINUED;
168
169 i = POLL_IN;
170 i = POLL_OUT;
171 i = POLL_MSG;
172 i = POLL_ERR;
173 i = POLL_PRI;
174 i = POLL_HUP;
175
176 i = SI_USER;
177 i = SI_QUEUE;
178 i = SI_TIMER;
179 i = SI_ASYNCIO;
180 i = SI_MESGQ;
181
182 typedef void (*signal_handler_type)(int);
183
184 FUNCTION(kill, int (*f)(pid_t, int));
185 FUNCTION(killpg, int (*f)(pid_t, int));
186 FUNCTION(psiginfo, void (*f)(const siginfo_t*, const char*));
187 FUNCTION(psignal, void (*f)(int, const char*));
188 FUNCTION(pthread_kill, int (*f)(pthread_t, int));
189 FUNCTION(pthread_sigmask, int (*f)(int, const sigset_t*, sigset_t*));
190 FUNCTION(raise, int (*f)(int));
Elliott Hughes55c1e372024-08-08 19:37:14 +0000191#if !defined(__GLIBC__) // Our glibc is too old.
192 FUNCTION(sig2str, int (*f)(int, char*));
193#endif
Elliott Hughes21b56eb2017-10-20 17:57:17 -0700194 FUNCTION(sigaction, int (*f)(int, const struct sigaction*, struct sigaction*));
195 FUNCTION(sigaddset, int (*f)(sigset_t*, int));
196 FUNCTION(sigaltstack, int (*f)(const stack_t*, stack_t*));
197 FUNCTION(sigdelset, int (*f)(sigset_t*, int));
198 FUNCTION(sigemptyset, int (*f)(sigset_t*));
199 FUNCTION(sigfillset, int (*f)(sigset_t*));
200 FUNCTION(sighold, int (*f)(int));
201 FUNCTION(sigignore, int (*f)(int));
202 FUNCTION(siginterrupt, int (*f)(int, int));
203 FUNCTION(sigismember, int (*f)(const sigset_t*, int));
204 FUNCTION(signal, signal_handler_type (*f)(int, signal_handler_type));
205 FUNCTION(sigpause, int (*f)(int));
206 FUNCTION(sigpending, int (*f)(sigset_t*));
207 FUNCTION(sigprocmask, int (*f)(int, const sigset_t*, sigset_t*));
208 FUNCTION(sigqueue, int (*f)(pid_t, int, union sigval));
209 FUNCTION(sigrelse, int (*f)(int));
210 FUNCTION(sigset, signal_handler_type (*f)(int, signal_handler_type));
211 FUNCTION(sigsuspend, int (*f)(const sigset_t*));
212 FUNCTION(sigtimedwait, int (*f)(const sigset_t*, siginfo_t*, const struct timespec*));
213 FUNCTION(sigwait, int (*f)(const sigset_t*, int*));
214 FUNCTION(sigwaitinfo, int (*f)(const sigset_t*, siginfo_t*));
Elliott Hughes55c1e372024-08-08 19:37:14 +0000215#if !defined(__GLIBC__) // Our glibc is too old.
216 FUNCTION(str2sig, int (*f)(const char*, int*));
217#endif
Elliott Hughes21b56eb2017-10-20 17:57:17 -0700218}