OLD | NEW |
(Empty) | |
| 1 #ifndef _SIGNAL_H |
| 2 #define _SIGNAL_H |
| 3 |
| 4 #ifdef __cplusplus |
| 5 extern "C" { |
| 6 #endif |
| 7 |
| 8 #include <features.h> |
| 9 |
| 10 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ |
| 11 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ |
| 12 || defined(_BSD_SOURCE) |
| 13 |
| 14 #ifdef _GNU_SOURCE |
| 15 #define __ucontext ucontext |
| 16 #endif |
| 17 |
| 18 #define __NEED_size_t |
| 19 #define __NEED_pid_t |
| 20 #define __NEED_uid_t |
| 21 #define __NEED_struct_timespec |
| 22 #define __NEED_pthread_t |
| 23 #define __NEED_pthread_attr_t |
| 24 #define __NEED_time_t |
| 25 #define __NEED_clock_t |
| 26 #define __NEED_sigset_t |
| 27 |
| 28 #include <bits/alltypes.h> |
| 29 |
| 30 #define SIG_HOLD ((void (*)(int)) 2) |
| 31 |
| 32 #define SIG_BLOCK 0 |
| 33 #define SIG_UNBLOCK 1 |
| 34 #define SIG_SETMASK 2 |
| 35 |
| 36 #define SI_ASYNCNL (-60) |
| 37 #define SI_TKILL (-6) |
| 38 #define SI_SIGIO (-5) |
| 39 #define SI_ASYNCIO (-4) |
| 40 #define SI_MESGQ (-3) |
| 41 #define SI_TIMER (-2) |
| 42 #define SI_QUEUE (-1) |
| 43 #define SI_USER 0 |
| 44 #define SI_KERNEL 128 |
| 45 |
| 46 #define FPE_INTDIV 1 |
| 47 #define FPE_INTOVF 2 |
| 48 #define FPE_FLTDIV 3 |
| 49 #define FPE_FLTOVF 4 |
| 50 #define FPE_FLTUND 5 |
| 51 #define FPE_FLTRES 6 |
| 52 #define FPE_FLTINV 7 |
| 53 #define FPE_FLTSUB 8 |
| 54 |
| 55 #define ILL_ILLOPC 1 |
| 56 #define ILL_ILLOPN 2 |
| 57 #define ILL_ILLADR 3 |
| 58 #define ILL_ILLTRP 4 |
| 59 #define ILL_PRVOPC 5 |
| 60 #define ILL_PRVREG 6 |
| 61 #define ILL_COPROC 7 |
| 62 #define ILL_BADSTK 8 |
| 63 |
| 64 #define SEGV_MAPERR 1 |
| 65 #define SEGV_ACCERR 2 |
| 66 #define SEGV_BNDERR 3 |
| 67 |
| 68 #define BUS_ADRALN 1 |
| 69 #define BUS_ADRERR 2 |
| 70 #define BUS_OBJERR 3 |
| 71 #define BUS_MCEERR_AR 4 |
| 72 #define BUS_MCEERR_AO 5 |
| 73 |
| 74 #define CLD_EXITED 1 |
| 75 #define CLD_KILLED 2 |
| 76 #define CLD_DUMPED 3 |
| 77 #define CLD_TRAPPED 4 |
| 78 #define CLD_STOPPED 5 |
| 79 #define CLD_CONTINUED 6 |
| 80 |
| 81 typedef struct sigaltstack stack_t; |
| 82 |
| 83 union sigval { |
| 84 int sival_int; |
| 85 void *sival_ptr; |
| 86 }; |
| 87 |
| 88 typedef struct { |
| 89 int si_signo, si_errno, si_code; |
| 90 union { |
| 91 char __pad[128 - 2*sizeof(int) - sizeof(long)]; |
| 92 struct { |
| 93 union { |
| 94 struct { |
| 95 pid_t si_pid; |
| 96 uid_t si_uid; |
| 97 } __piduid; |
| 98 struct { |
| 99 int si_timerid; |
| 100 int si_overrun; |
| 101 } __timer; |
| 102 } __first; |
| 103 union { |
| 104 union sigval si_value; |
| 105 struct { |
| 106 int si_status; |
| 107 clock_t si_utime, si_stime; |
| 108 } __sigchld; |
| 109 } __second; |
| 110 } __si_common; |
| 111 struct { |
| 112 void *si_addr; |
| 113 short si_addr_lsb; |
| 114 struct { |
| 115 void *si_lower; |
| 116 void *si_upper; |
| 117 } __addr_bnd; |
| 118 } __sigfault; |
| 119 struct { |
| 120 long si_band; |
| 121 int si_fd; |
| 122 } __sigpoll; |
| 123 struct { |
| 124 void *si_call_addr; |
| 125 int si_syscall; |
| 126 unsigned si_arch; |
| 127 } __sigsys; |
| 128 } __si_fields; |
| 129 } siginfo_t; |
| 130 #define si_pid __si_fields.__si_common.__first.__piduid.si_pid |
| 131 #define si_uid __si_fields.__si_common.__first.__piduid.si_uid |
| 132 #define si_status __si_fields.__si_common.__second.__sigchld.si_status |
| 133 #define si_utime __si_fields.__si_common.__second.__sigchld.si_utime |
| 134 #define si_stime __si_fields.__si_common.__second.__sigchld.si_stime |
| 135 #define si_value __si_fields.__si_common.__second.si_value |
| 136 #define si_addr __si_fields.__sigfault.si_addr |
| 137 #define si_addr_lsb __si_fields.__sigfault.si_addr_lsb |
| 138 #define si_lower __si_fields.__sigfault.__addr_bnd.si_lower |
| 139 #define si_upper __si_fields.__sigfault.__addr_bnd.si_upper |
| 140 #define si_band __si_fields.__sigpoll.si_band |
| 141 #define si_fd __si_fields.__sigpoll.si_fd |
| 142 #define si_timerid __si_fields.__si_common.__first.__timer.si_timerid |
| 143 #define si_overrun __si_fields.__si_common.__first.__timer.si_overrun |
| 144 #define si_ptr si_value.sival_ptr |
| 145 #define si_int si_value.sival_int |
| 146 #define si_call_addr __si_fields.__sigsys.si_call_addr |
| 147 #define si_syscall __si_fields.__sigsys.si_syscall |
| 148 #define si_arch __si_fields.__sigsys.si_arch |
| 149 |
| 150 struct sigaction { |
| 151 union { |
| 152 void (*sa_handler)(int); |
| 153 void (*sa_sigaction)(int, siginfo_t *, void *); |
| 154 } __sa_handler; |
| 155 sigset_t sa_mask; |
| 156 int sa_flags; |
| 157 void (*sa_restorer)(void); |
| 158 }; |
| 159 #define sa_handler __sa_handler.sa_handler |
| 160 #define sa_sigaction __sa_handler.sa_sigaction |
| 161 |
| 162 struct sigevent { |
| 163 union sigval sigev_value; |
| 164 int sigev_signo; |
| 165 int sigev_notify; |
| 166 void (*sigev_notify_function)(union sigval); |
| 167 pthread_attr_t *sigev_notify_attributes; |
| 168 char __pad[56-3*sizeof(long)]; |
| 169 }; |
| 170 |
| 171 #define SIGEV_SIGNAL 0 |
| 172 #define SIGEV_NONE 1 |
| 173 #define SIGEV_THREAD 2 |
| 174 |
| 175 int __libc_current_sigrtmin(void); |
| 176 int __libc_current_sigrtmax(void); |
| 177 |
| 178 #define SIGRTMIN (__libc_current_sigrtmin()) |
| 179 #define SIGRTMAX (__libc_current_sigrtmax()) |
| 180 |
| 181 int kill(pid_t, int); |
| 182 |
| 183 int sigemptyset(sigset_t *); |
| 184 int sigfillset(sigset_t *); |
| 185 int sigaddset(sigset_t *, int); |
| 186 int sigdelset(sigset_t *, int); |
| 187 int sigismember(const sigset_t *, int); |
| 188 |
| 189 int sigprocmask(int, const sigset_t *__restrict, sigset_t *__restrict); |
| 190 int sigsuspend(const sigset_t *); |
| 191 int sigaction(int, const struct sigaction *__restrict, struct sigaction *__restr
ict); |
| 192 int sigpending(sigset_t *); |
| 193 int sigwait(const sigset_t *__restrict, int *__restrict); |
| 194 int sigwaitinfo(const sigset_t *__restrict, siginfo_t *__restrict); |
| 195 int sigtimedwait(const sigset_t *__restrict, siginfo_t *__restrict, const struct
timespec *__restrict); |
| 196 int sigqueue(pid_t, int, const union sigval); |
| 197 |
| 198 int pthread_sigmask(int, const sigset_t *__restrict, sigset_t *__restrict); |
| 199 int pthread_kill(pthread_t, int); |
| 200 |
| 201 void psiginfo(const siginfo_t *, const char *); |
| 202 void psignal(int, const char *); |
| 203 |
| 204 #endif |
| 205 |
| 206 #if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) |
| 207 int killpg(pid_t, int); |
| 208 int sigaltstack(const stack_t *__restrict, stack_t *__restrict); |
| 209 int sighold(int); |
| 210 int sigignore(int); |
| 211 int siginterrupt(int, int); |
| 212 int sigpause(int); |
| 213 int sigrelse(int); |
| 214 void (*sigset(int, void (*)(int)))(int); |
| 215 #define TRAP_BRKPT 1 |
| 216 #define TRAP_TRACE 2 |
| 217 #define POLL_IN 1 |
| 218 #define POLL_OUT 2 |
| 219 #define POLL_MSG 3 |
| 220 #define POLL_ERR 4 |
| 221 #define POLL_PRI 5 |
| 222 #define POLL_HUP 6 |
| 223 #define SS_ONSTACK 1 |
| 224 #define SS_DISABLE 2 |
| 225 #endif |
| 226 |
| 227 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) |
| 228 #define NSIG _NSIG |
| 229 typedef void (*sig_t)(int); |
| 230 #endif |
| 231 |
| 232 #ifdef _GNU_SOURCE |
| 233 typedef void (*sighandler_t)(int); |
| 234 void (*bsd_signal(int, void (*)(int)))(int); |
| 235 int sigisemptyset(const sigset_t *); |
| 236 int sigorset (sigset_t *, const sigset_t *, const sigset_t *); |
| 237 int sigandset(sigset_t *, const sigset_t *, const sigset_t *); |
| 238 |
| 239 #define SA_NOMASK SA_NODEFER |
| 240 #define SA_ONESHOT SA_RESETHAND |
| 241 #endif |
| 242 |
| 243 #include <bits/signal.h> |
| 244 |
| 245 #define SIG_ERR ((void (*)(int))-1) |
| 246 #define SIG_DFL ((void (*)(int)) 0) |
| 247 #define SIG_IGN ((void (*)(int)) 1) |
| 248 |
| 249 typedef int sig_atomic_t; |
| 250 |
| 251 void (*signal(int, void (*)(int)))(int); |
| 252 int raise(int); |
| 253 |
| 254 #ifdef __cplusplus |
| 255 } |
| 256 #endif |
| 257 |
| 258 #endif |
OLD | NEW |