api: add sched.c .. signal.c
[libc-test] / src / api / signal.c
1 #include <signal.h>
2 #define T(t) (t*)0;
3 #define F(t,n) {t *y = &x.n;}
4 #define C(n) switch(n){case n:;}
5 static void f()
6 {
7 T(sig_atomic_t)
8 {void(*x)(int) = SIG_DFL;}
9 {void(*x)(int) = SIG_ERR;}
10 {void(*x)(int) = SIG_IGN;}
11 #ifdef _POSIX_C_SOURCE
12 {void(*x)(int) = SIG_HOLD;}
13 T(size_t)
14 T(sigset_t)
15 T(pid_t)
16 T(uid_t)
17 T(pthread_t)
18 T(pthread_attr_t)
19 T(struct timespec)
20 {
21 struct sigevent x;
22 F(int,sigev_notify)
23 F(int,sigev_signo)
24 F(union sigval,sigev_value)
25 {void (**y)(union sigval) = &x.sigev_notify_function;}
26 F(pthread_attr_t*,sigev_notify_attributes)
27 }
28 C(SIGEV_NONE)
29 C(SIGEV_SIGNAL)
30 C(SIGEV_THREAD)
31 {
32 union sigval x;
33 F(int,sival_int)
34 F(void*,sival_ptr)
35 }
36 {int i = SIGRTMIN;}
37 {int i = SIGRTMAX;}
38 #endif
39 C(SIGABRT)
40 C(SIGFPE)
41 C(SIGILL)
42 C(SIGINT)
43 C(SIGSEGV)
44 C(SIGTERM)
45 #ifdef _POSIX_C_SOURCE
46 C(SIGALRM)
47 C(SIGBUS)
48 C(SIGCHLD)
49 C(SIGCONT)
50 C(SIGHUP)
51 C(SIGKILL)
52 C(SIGPIPE)
53 C(SIGQUIT)
54 C(SIGSTOP)
55 C(SIGTSTP)
56 C(SIGTTIN)
57 C(SIGTTOU)
58 C(SIGUSR1)
59 C(SIGUSR2)
60 C(SIGURG)
61 #ifdef _XOPEN_SOURCE
62 C(SIGSYS)
63 C(SIGTRAP)
64 C(SIGVTALRM)
65 C(SIGXCPU)
66 C(SIGXFSZ)
67 #endif
68 {
69 struct sigaction x;
70 {void (**y)(int) = &x.sa_handler;}
71 F(sigset_t, sa_mask)
72 F(int,sa_flags)
73 {void (**y)(int, siginfo_t *, void *) = &x.sa_sigaction;}
74 }
75 C(SIG_BLOCK)
76 C(SIG_UNBLOCK)
77 C(SIG_SETMASK)
78 C(SA_NOCLDSTOP)
79 C(SA_RESETHAND)
80 C(SA_RESTART)
81 C(SA_SIGINFO)
82 C(SA_NOCLDWAIT)
83 C(SA_NODEFER)
84 #ifdef _XOPEN_SOURCE
85 C(SA_ONSTACK)
86 C(SS_ONSTACK)
87 C(SS_DISABLE)
88 C(MINSIGSTKSZ)
89 C(SIGSTKSZ)
90 #endif
91 T(mcontext_t)
92 {
93 ucontext_t x;
94 F(ucontext_t*,uc_link)
95 F(sigset_t,uc_sigmask)
96 F(stack_t, uc_stack)
97 F(mcontext_t,uc_mcontext)
98 }
99 {
100 stack_t x;
101 F(void *,ss_sp)
102 F(size_t,ss_size)
103 F(int, ss_flags)
104 }
105 {
106 siginfo_t x;
107 F(int, si_signo)
108 F(int, si_code)
109 #ifdef _XOPEN_SOURCE
110 F(int, si_errno)
111 #endif
112 F(pid_t, si_pid)
113 F(uid_t, si_uid)
114 F(void *,si_addr)
115 F(int, si_status)
116 F(union sigval,si_value)
117 }
118 C(ILL_ILLOPC)
119 C(ILL_ILLOPN)
120 C(ILL_ILLADR)
121 C(ILL_ILLTRP)
122 C(ILL_PRVOPC)
123 C(ILL_PRVREG)
124 C(ILL_COPROC)
125 C(ILL_BADSTK)
126 C(FPE_INTDIV)
127 C(FPE_INTOVF)
128 C(FPE_FLTDIV)
129 C(FPE_FLTOVF)
130 C(FPE_FLTUND)
131 C(FPE_FLTRES)
132 C(FPE_FLTINV)
133 C(FPE_FLTSUB)
134 C(SEGV_MAPERR)
135 C(SEGV_ACCERR)
136 C(BUS_ADRALN)
137 C(BUS_ADRERR)
138 C(BUS_OBJERR)
139 #ifdef _XOPEN_SOURCE
140 C(TRAP_BRKPT)
141 C(TRAP_TRACE)
142 #endif
143 C(CLD_EXITED)
144 C(CLD_KILLED)
145 C(CLD_DUMPED)
146 C(CLD_TRAPPED)
147 C(CLD_STOPPED)
148 C(CLD_CONTINUED)
149 C(SI_USER)
150 C(SI_QUEUE)
151 C(SI_TIMER)
152 C(SI_ASYNCIO)
153 C(SI_MESGQ)
154 int(*p_kill)(pid_t,int) = kill;
155 int(*p_killpg)(pid_t,int) = killpg;
156 void(*p_psiginfo)(const siginfo_t*,const char*) = psiginfo;
157 void(*p_psignal)(int,const char*) = psignal;
158 int(*p_pthread_kill)(pthread_t,int) = pthread_kill;
159 int(*p_pthread_sigmask)(int,const sigset_t*restrict,sigset_t*restrict) = pthread_sigmask;
160 int(*p_sigaction)(int,const struct sigaction*restrict,struct sigaction*restrict) = sigaction;
161 int(*p_sigaddset)(sigset_t*,int) = sigaddset;
162 int(*p_sigaltstack)(const stack_t*restrict,stack_t*restrict) = sigaltstack;
163 int(*p_sigdelset)(sigset_t*,int) = sigdelset;
164 int(*p_sigemptyset)(sigset_t*) = sigemptyset;
165 int(*p_sigfillset)(sigset_t*) = sigfillset;
166 int(*p_sighold)(int) = sighold;
167 int(*p_sigignore)(int) = sigignore;
168 int(*p_siginterrupt)(int,int) = siginterrupt;
169 int(*p_sigismember)(const sigset_t*,int) = sigismember;
170 int(*p_sigpause)(int) = sigpause;
171 int(*p_sigpending)(sigset_t*) = sigpending;
172 int(*p_sigprocmask)(int,const sigset_t*restrict,sigset_t*restrict) = sigprocmask;
173 int(*p_sigqueue)(pid_t,int,const union sigval) = sigqueue;
174 int(*p_sigrelse)(int) = sigrelse;
175 void(*(*p_sigset)(int,void(*)(int)))(int) = sigset;
176 int(*p_sigsuspend)(const sigset_t*) = sigsuspend;
177 int(*p_sigtimedwait)(const sigset_t*restrict,siginfo_t*restrict,const struct timespec*restrict) = sigtimedwait;
178 int(*p_sigwait)(const sigset_t*restrict,int*restrict) = sigwait;
179 int(*p_sigwaitinfo)(const sigset_t*restrict,siginfo_t*restrict) = sigwaitinfo;
180 #endif
181 int(*p_raise)(int) = raise;
182 void(*(*p_signal)(int,void(*)(int)))(int) = signal;
183 }