• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *  * Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  *  * Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in
12  *    the documentation and/or other materials provided with the
13  *    distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 #include <signal.h>
30 
31 #include "header_checks.h"
32 
signal_h()33 static void signal_h() {
34   void (*h)(int);
35   h = SIG_DFL;
36   h = SIG_ERR;
37   h = SIG_HOLD;
38   h = SIG_IGN;
39 
40   TYPE(pthread_t);
41   TYPE(size_t);
42   TYPE(uid_t);
43 
44   TYPE(struct timespec);
45 
46   TYPE(sig_atomic_t);
47   TYPE(pid_t);
48 
49   TYPE(pthread_attr_t);
50 
51   TYPE(struct sigevent);
52   STRUCT_MEMBER(struct sigevent, int, sigev_notify);
53   STRUCT_MEMBER(struct sigevent, int, sigev_signo);
54   STRUCT_MEMBER(struct sigevent, union sigval, sigev_value);
55   STRUCT_MEMBER_FUNCTION_POINTER(struct sigevent, void (*f)(union sigval), sigev_notify_function);
56 #if defined(__BIONIC__)
57   STRUCT_MEMBER(struct sigevent, void*, sigev_notify_attributes);
58 #else
59   STRUCT_MEMBER(struct sigevent, pthread_attr_t*, sigev_notify_attributes);
60 #endif
61 
62   MACRO(SIGEV_NONE);
63   MACRO(SIGEV_SIGNAL);
64   MACRO(SIGEV_THREAD);
65 
66   TYPE(union sigval);
67   STRUCT_MEMBER(union sigval, int, sival_int);
68   STRUCT_MEMBER(union sigval, void*, sival_ptr);
69 
70   int i;
71   i = SIGRTMIN;
72   i = SIGRTMAX;
73 
74   MACRO(SIGABRT);
75   MACRO(SIGALRM);
76   MACRO(SIGBUS);
77   MACRO(SIGCHLD);
78   MACRO(SIGCONT);
79   MACRO(SIGFPE);
80   MACRO(SIGHUP);
81   MACRO(SIGILL);
82   MACRO(SIGINT);
83   MACRO(SIGKILL);
84   MACRO(SIGPIPE);
85   MACRO(SIGQUIT);
86   MACRO(SIGSEGV);
87   MACRO(SIGSTOP);
88   MACRO(SIGTERM);
89   MACRO(SIGTSTP);
90   MACRO(SIGTTIN);
91   MACRO(SIGTTOU);
92   MACRO(SIGUSR1);
93   MACRO(SIGUSR2);
94   MACRO(SIGPOLL);
95   MACRO(SIGPROF);
96   MACRO(SIGSYS);
97   MACRO(SIGTRAP);
98   MACRO(SIGURG);
99   MACRO(SIGVTALRM);
100   MACRO(SIGXCPU);
101   MACRO(SIGXFSZ);
102 
103   TYPE(struct sigaction);
104   STRUCT_MEMBER_FUNCTION_POINTER(struct sigaction, void (*f)(int), sa_handler);
105   STRUCT_MEMBER(struct sigaction, sigset_t, sa_mask);
106   STRUCT_MEMBER(struct sigaction, int, sa_flags);
107   STRUCT_MEMBER_FUNCTION_POINTER(struct sigaction, void (*f)(int, siginfo_t*, void*), sa_sigaction);
108 
109   i = SIG_BLOCK;
110   i = SIG_UNBLOCK;
111   i = SIG_SETMASK;
112 
113   MACRO(SA_NOCLDSTOP);
114   MACRO(SA_ONSTACK);
115   MACRO(SA_RESETHAND);
116   MACRO(SA_RESTART);
117   MACRO(SA_SIGINFO);
118   MACRO(SA_NOCLDWAIT);
119   MACRO(SA_NODEFER);
120 
121   MACRO(SS_ONSTACK);
122   MACRO(SS_DISABLE);
123 
124   MACRO(MINSIGSTKSZ);
125   MACRO(SIGSTKSZ);
126 
127   TYPE(mcontext_t);
128 
129   TYPE(ucontext_t);
130   STRUCT_MEMBER(ucontext_t, ucontext_t*, uc_link);
131   STRUCT_MEMBER(ucontext_t, sigset_t, uc_sigmask);
132   STRUCT_MEMBER(ucontext_t, stack_t, uc_stack);
133   STRUCT_MEMBER(ucontext_t, mcontext_t, uc_mcontext);
134 
135   TYPE(stack_t);
136   STRUCT_MEMBER(stack_t, void*, ss_sp);
137   STRUCT_MEMBER(stack_t, size_t, ss_size);
138   STRUCT_MEMBER(stack_t, int, ss_flags);
139 
140   TYPE(siginfo_t);
141   STRUCT_MEMBER(siginfo_t, int, si_signo);
142   STRUCT_MEMBER(siginfo_t, int, si_code);
143   STRUCT_MEMBER(siginfo_t, int, si_errno);
144   STRUCT_MEMBER(siginfo_t, pid_t, si_pid);
145   STRUCT_MEMBER(siginfo_t, uid_t, si_uid);
146   STRUCT_MEMBER(siginfo_t, void*, si_addr);
147   STRUCT_MEMBER(siginfo_t, int, si_status);
148   STRUCT_MEMBER(siginfo_t, long, si_band);
149   STRUCT_MEMBER(siginfo_t, union sigval, si_value);
150 
151   i = ILL_ILLOPC;
152   i = ILL_ILLOPN;
153   i = ILL_ILLADR;
154   i = ILL_ILLTRP;
155   i = ILL_PRVOPC;
156   i = ILL_PRVREG;
157   i = ILL_COPROC;
158   i = ILL_BADSTK;
159 
160   i = FPE_INTDIV;
161   i = FPE_INTOVF;
162   i = FPE_FLTDIV;
163   i = FPE_FLTOVF;
164   i = FPE_FLTUND;
165   i = FPE_FLTRES;
166   i = FPE_FLTINV;
167   i = FPE_FLTSUB;
168 
169   i = SEGV_MAPERR;
170   i = SEGV_ACCERR;
171 
172   i = BUS_ADRALN;
173   i = BUS_ADRERR;
174   i = BUS_OBJERR;
175 
176   i = TRAP_BRKPT;
177   i = TRAP_TRACE;
178 
179   i = CLD_EXITED;
180   i = CLD_KILLED;
181   i = CLD_DUMPED;
182   i = CLD_TRAPPED;
183   i = CLD_STOPPED;
184   i = CLD_CONTINUED;
185 
186   i = POLL_IN;
187   i = POLL_OUT;
188   i = POLL_MSG;
189   i = POLL_ERR;
190   i = POLL_PRI;
191   i = POLL_HUP;
192 
193   i = SI_USER;
194   i = SI_QUEUE;
195   i = SI_TIMER;
196   i = SI_ASYNCIO;
197   i = SI_MESGQ;
198 
199   typedef void (*signal_handler_type)(int);
200 
201   FUNCTION(kill, int (*f)(pid_t, int));
202   FUNCTION(killpg, int (*f)(pid_t, int));
203   FUNCTION(psiginfo, void (*f)(const siginfo_t*, const char*));
204   FUNCTION(psignal, void (*f)(int, const char*));
205   FUNCTION(pthread_kill, int (*f)(pthread_t, int));
206   FUNCTION(pthread_sigmask, int (*f)(int, const sigset_t*, sigset_t*));
207   FUNCTION(raise, int (*f)(int));
208   FUNCTION(sigaction, int (*f)(int, const struct sigaction*, struct sigaction*));
209   FUNCTION(sigaddset, int (*f)(sigset_t*, int));
210   FUNCTION(sigaltstack, int (*f)(const stack_t*, stack_t*));
211   FUNCTION(sigdelset, int (*f)(sigset_t*, int));
212   FUNCTION(sigemptyset, int (*f)(sigset_t*));
213   FUNCTION(sigfillset, int (*f)(sigset_t*));
214   FUNCTION(sighold, int (*f)(int));
215   FUNCTION(sigignore, int (*f)(int));
216   FUNCTION(siginterrupt, int (*f)(int, int));
217   FUNCTION(sigismember, int (*f)(const sigset_t*, int));
218   FUNCTION(signal, signal_handler_type (*f)(int, signal_handler_type));
219   FUNCTION(sigpause, int (*f)(int));
220   FUNCTION(sigpending, int (*f)(sigset_t*));
221   FUNCTION(sigprocmask, int (*f)(int, const sigset_t*, sigset_t*));
222   FUNCTION(sigqueue, int (*f)(pid_t, int, union sigval));
223   FUNCTION(sigrelse, int (*f)(int));
224   FUNCTION(sigset, signal_handler_type (*f)(int, signal_handler_type));
225   FUNCTION(sigsuspend, int (*f)(const sigset_t*));
226   FUNCTION(sigtimedwait, int (*f)(const sigset_t*, siginfo_t*, const struct timespec*));
227   FUNCTION(sigwait, int (*f)(const sigset_t*, int*));
228   FUNCTION(sigwaitinfo, int (*f)(const sigset_t*, siginfo_t*));
229 }
230