|| defined(_BSD_SOURCE)
#ifdef _GNU_SOURCE
-#define __siginfo siginfo
#define __ucontext ucontext
#endif
#define __NEED_time_t
#define __NEED_clock_t
#define __NEED_sigset_t
-#define __NEED_siginfo_t
#include <bits/alltypes.h>
-#define SIG_HOLD ((void (*)(int)) 2)
-
#define SIG_BLOCK 0
#define SIG_UNBLOCK 1
#define SIG_SETMASK 2
#define SI_USER 0
#define SI_KERNEL 128
+typedef struct sigaltstack stack_t;
+
+#endif
+
+#include <bits/signal.h>
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define SIG_HOLD ((void (*)(int)) 2)
+
#define FPE_INTDIV 1
#define FPE_INTOVF 2
#define FPE_FLTDIV 3
#define SEGV_MAPERR 1
#define SEGV_ACCERR 2
+#define SEGV_BNDERR 3
+#define SEGV_PKUERR 4
#define BUS_ADRALN 1
#define BUS_ADRERR 2
#define BUS_OBJERR 3
+#define BUS_MCEERR_AR 4
+#define BUS_MCEERR_AO 5
#define CLD_EXITED 1
#define CLD_KILLED 2
#define CLD_STOPPED 5
#define CLD_CONTINUED 6
-struct sigaction {
- union {
- void (*sa_handler)(int);
- void (*sa_sigaction)(int, siginfo_t *, void *);
- } __sa_handler;
- sigset_t sa_mask;
- int sa_flags;
- void (*sa_restorer)(void);
-};
-#define sa_handler __sa_handler.sa_handler
-#define sa_sigaction __sa_handler.sa_sigaction
-
-typedef struct {
- void *ss_sp;
- int ss_flags;
- size_t ss_size;
-} stack_t;
-
union sigval {
int sival_int;
void *sival_ptr;
};
-struct __siginfo {
+typedef struct {
+#ifdef __SI_SWAP_ERRNO_CODE
+ int si_signo, si_code, si_errno;
+#else
int si_signo, si_errno, si_code;
+#endif
union {
- char __pad[128 - 3*sizeof(int)];
- struct {
- pid_t si_pid;
- uid_t si_uid;
- union sigval si_sigval;
- } __rt;
- struct {
- unsigned int si_timer1, si_timer2;
- } __timer;
+ char __pad[128 - 2*sizeof(int) - sizeof(long)];
struct {
- pid_t si_pid;
- uid_t si_uid;
- int si_status;
- clock_t si_utime, si_stime;
- } __sigchld;
+ union {
+ struct {
+ pid_t si_pid;
+ uid_t si_uid;
+ } __piduid;
+ struct {
+ int si_timerid;
+ int si_overrun;
+ } __timer;
+ } __first;
+ union {
+ union sigval si_value;
+ struct {
+ int si_status;
+ clock_t si_utime, si_stime;
+ } __sigchld;
+ } __second;
+ } __si_common;
struct {
void *si_addr;
+ short si_addr_lsb;
+ union {
+ struct {
+ void *si_lower;
+ void *si_upper;
+ } __addr_bnd;
+ unsigned si_pkey;
+ } __first;
} __sigfault;
struct {
long si_band;
int si_fd;
} __sigpoll;
+ struct {
+ void *si_call_addr;
+ int si_syscall;
+ unsigned si_arch;
+ } __sigsys;
} __si_fields;
-};
-#define si_pid __si_fields.__sigchld.si_pid
-#define si_uid __si_fields.__sigchld.si_uid
-#define si_status __si_fields.__sigchld.si_status
-#define si_utime __si_fields.__sigchld.si_utime
-#define si_stime __si_fields.__sigchld.si_stime
-#define si_value __si_fields.__rt.si_sigval
+} siginfo_t;
+#define si_pid __si_fields.__si_common.__first.__piduid.si_pid
+#define si_uid __si_fields.__si_common.__first.__piduid.si_uid
+#define si_status __si_fields.__si_common.__second.__sigchld.si_status
+#define si_utime __si_fields.__si_common.__second.__sigchld.si_utime
+#define si_stime __si_fields.__si_common.__second.__sigchld.si_stime
+#define si_value __si_fields.__si_common.__second.si_value
#define si_addr __si_fields.__sigfault.si_addr
+#define si_addr_lsb __si_fields.__sigfault.si_addr_lsb
+#define si_lower __si_fields.__sigfault.__first.__addr_bnd.si_lower
+#define si_upper __si_fields.__sigfault.__first.__addr_bnd.si_upper
+#define si_pkey __si_fields.__sigfault.__first.si_pkey
#define si_band __si_fields.__sigpoll.si_band
#define si_fd __si_fields.__sigpoll.si_fd
-#define si_timer1 __si_fields.__timer.si_timer1
-#define si_timer2 __si_fields.__timer.si_timer2
-#define si_ptr __si_fields.__rt.si_sigval.sival_ptr
-#define si_int __si_fields.__rt.si_sigval.sival_int
+#define si_timerid __si_fields.__si_common.__first.__timer.si_timerid
+#define si_overrun __si_fields.__si_common.__first.__timer.si_overrun
+#define si_ptr si_value.sival_ptr
+#define si_int si_value.sival_int
+#define si_call_addr __si_fields.__sigsys.si_call_addr
+#define si_syscall __si_fields.__sigsys.si_syscall
+#define si_arch __si_fields.__sigsys.si_arch
+
+struct sigaction {
+ union {
+ void (*sa_handler)(int);
+ void (*sa_sigaction)(int, siginfo_t *, void *);
+ } __sa_handler;
+ sigset_t sa_mask;
+ int sa_flags;
+ void (*sa_restorer)(void);
+};
+#define sa_handler __sa_handler.sa_handler
+#define sa_sigaction __sa_handler.sa_sigaction
struct sigevent {
union sigval sigev_value;
int sigwait(const sigset_t *__restrict, int *__restrict);
int sigwaitinfo(const sigset_t *__restrict, siginfo_t *__restrict);
int sigtimedwait(const sigset_t *__restrict, siginfo_t *__restrict, const struct timespec *__restrict);
-int sigqueue(pid_t, int, const union sigval);
+int sigqueue(pid_t, int, union sigval);
int pthread_sigmask(int, const sigset_t *__restrict, sigset_t *__restrict);
int pthread_kill(pthread_t, int);
#endif
-#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
int killpg(pid_t, int);
int sigaltstack(const stack_t *__restrict, stack_t *__restrict);
int sighold(int);
void (*sigset(int, void (*)(int)))(int);
#define TRAP_BRKPT 1
#define TRAP_TRACE 2
+#define TRAP_BRANCH 3
+#define TRAP_HWBKPT 4
+#define TRAP_UNK 5
#define POLL_IN 1
#define POLL_OUT 2
#define POLL_MSG 3
#define POLL_HUP 6
#define SS_ONSTACK 1
#define SS_DISABLE 2
-#define MINSIGSTKSZ 2048
-#define SIGSTKSZ 8192
+#define SS_AUTODISARM (1U << 31)
+#define SS_FLAG_BITS SS_AUTODISARM
#endif
-#ifdef _BSD_SOURCE
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define NSIG _NSIG
typedef void (*sig_t)(int);
#endif
typedef void (*sighandler_t)(int);
void (*bsd_signal(int, void (*)(int)))(int);
int sigisemptyset(const sigset_t *);
+int sigorset (sigset_t *, const sigset_t *, const sigset_t *);
+int sigandset(sigset_t *, const sigset_t *, const sigset_t *);
+
#define SA_NOMASK SA_NODEFER
#define SA_ONESHOT SA_RESETHAND
-#define NSIG _NSIG
#endif
-#include <bits/signal.h>
-
#define SIG_ERR ((void (*)(int))-1)
#define SIG_DFL ((void (*)(int)) 0)
#define SIG_IGN ((void (*)(int)) 1)