use core::ffi::c_void;
use crate::{pid_t, sigset_t, uid_t};
pub const __DARWIN_NSIG: i32 = 32;
pub const NSIG: i32 = __DARWIN_NSIG;
pub const SIGHUP: i32 = 1;
pub const SIGINT: i32 = 2;
pub const SIGQUIT: i32 = 3;
pub const SIGILL: i32 = 4;
pub const SIGTRAP: i32 = 5;
pub const SIGABRT: i32 = 6;
pub const SIGIOT: i32 = SIGABRT;
pub const SIGEMT: i32 = 7;
pub const SIGFPE: i32 = 8;
pub const SIGKILL: i32 = 9;
pub const SIGBUS: i32 = 10;
pub const SIGSEGV: i32 = 11;
pub const SIGSYS: i32 = 12;
pub const SIGPIPE: i32 = 13;
pub const SIGALRM: i32 = 14;
pub const SIGTERM: i32 = 15;
pub const SIGURG: i32 = 16;
pub const SIGSTOP: i32 = 17;
pub const SIGTSTP: i32 = 18;
pub const SIGCONT: i32 = 19;
pub const SIGCHLD: i32 = 20;
pub const SIGTTIN: i32 = 21;
pub const SIGTTOU: i32 = 22;
pub const SIGIO: i32 = 23;
pub const SIGXCPU: i32 = 24;
pub const SIGXFSZ: i32 = 25;
pub const SIGVTALRM: i32 = 26;
pub const SIGPROF: i32 = 27;
pub const SIGWINCH: i32 = 28;
pub const SIGINFO: i32 = 29;
pub const SIGUSR1: i32 = 30;
pub const SIGUSR2: i32 = 31;
pub type sighandler_t = usize;
pub const SIG_DFL: sighandler_t = 0;
pub const SIG_IGN: sighandler_t = 1;
pub const SIG_HOLD: sighandler_t = 5;
#[allow(clippy::cast_sign_loss)]
pub const SIG_ERR: sighandler_t = -1_isize as sighandler_t;
#[repr(C)]
pub union sigval_u {
sival_int: i32,
sival_ptr: *mut c_void,
}
pub const SIGEV_NONE: i32 = 0;
pub const SIGEV_SIGNAL: i32 = 1;
pub const SIGEV_THREAD: i32 = 3;
pub type sigev_notify_fn = fn(sigval_u);
#[repr(C)]
pub struct sigevent_t {
pub sigev_notify: i32,
pub sigev_signo: i32,
pub sigev_value: sigval_u,
pub sigev_notify_function: sigev_notify_fn,
pub sigev_notify_attributes: *mut c_void,
}
#[repr(C)]
pub struct siginfo_t {
pub si_signo: i32,
pub si_errno: i32,
pub si_code: i32,
pub si_pid: pid_t,
pub si_uid: uid_t,
pub si_status: i32,
pub si_addr: *mut c_void,
pub si_value: sigval_u,
pub si_band: isize,
__pad: [usize; 7],
}
pub const ILL_NOOP: i32 = 0;
pub const ILL_ILLOPC: i32 = 1;
pub const ILL_ILLTRP: i32 = 2;
pub const ILL_PRVOPC: i32 = 3;
pub const ILL_ILLOPN: i32 = 4;
pub const ILL_ILLADR: i32 = 5;
pub const ILL_PRVREG: i32 = 6;
pub const ILL_COPROC: i32 = 7;
pub const ILL_BADSTK: i32 = 8;
pub const FPE_NOOP: i32 = 0;
pub const FPE_FLTDIV: i32 = 1;
pub const FPE_FLTOVF: i32 = 2;
pub const FPE_FLTUND: i32 = 3;
pub const FPE_FLTRES: i32 = 4;
pub const FPE_FLTINV: i32 = 5;
pub const FPE_FLTSUB: i32 = 6;
pub const FPE_INTDIV: i32 = 7;
pub const FPE_INTOVF: i32 = 8;
pub const SEGV_NOOP: i32 = 0;
pub const SEGV_MAPERR: i32 = 1;
pub const SEGV_ACCERR: i32 = 2;
pub const BUS_NOOP: i32 = 0;
pub const BUS_ADRALN: i32 = 1;
pub const BUS_ADRERR: i32 = 2;
pub const BUS_OBJERR: i32 = 3;
pub const TRAP_BRKPT: i32 = 1;
pub const TRAP_TRACE: i32 = 2;
pub const CLD_NOOP: i32 = 0;
pub const CLD_EXITED: i32 = 1;
pub const CLD_KILLED: i32 = 2;
pub const CLD_DUMPED: i32 = 3;
pub const CLD_TRAPPED: i32 = 4;
pub const CLD_STOPPED: i32 = 5;
pub const CLD_CONTINUED: i32 = 6;
pub const POLL_IN: i32 = 1;
pub const POLL_OUT: i32 = 2;
pub const POLL_MSG: i32 = 3;
pub const POLL_ERR: i32 = 4;
pub const POLL_PRI: i32 = 5;
pub const POLL_HUP: i32 = 6;
pub type sa_handler_fn = fn(i32);
pub type sa_sigaction_fn = fn(i32, *mut siginfo_t, *mut c_void);
#[repr(C)]
pub union sigaction_u {
sa_handler: sa_handler_fn,
sa_sigaction: sa_sigaction_fn,
}
pub type sa_tramp_fn = fn(*mut c_void, i32, i32, *mut siginfo_t, *mut c_void);
#[repr(C)]
pub struct __sigaction_t {
pub __sigaction_u: sigaction_u,
pub sa_tramp: sa_tramp_fn,
pub sa_mask: sigset_t,
pub sa_flags: i32,
}
#[repr(C)]
pub struct sigaction_t {
pub __sigaction_u: sigaction_u,
pub sa_mask: sigset_t,
pub sa_flags: i32,
}
pub const SA_ONSTACK: i32 = 0x0001;
pub const SA_RESTART: i32 = 0x0002;
pub const SA_RESETHAND: i32 = 0x0004;
pub const SA_NOCLDSTOP: i32 = 0x0008;
pub const SA_NODEFER: i32 = 0x0010;
pub const SA_NOCLDWAIT: i32 = 0x0020;
pub const SA_SIGINFO: i32 = 0x0040;
pub const SA_USERTRAMP: i32 = 0x0100;
pub const SA_64REGSET: i32 = 0x0200;
pub const SA_USERSPACE_MASK: i32 =
SA_ONSTACK | SA_RESTART | SA_RESETHAND | SA_NOCLDSTOP | SA_NODEFER | SA_NOCLDWAIT | SA_SIGINFO;
pub const SIG_BLOCK: i32 = 1;
pub const SIG_UNBLOCK: i32 = 2;
pub const SIG_SETMASK: i32 = 3;
pub const SI_USER: i32 = 0x10001;
pub const SI_QUEUE: i32 = 0x10002;
pub const SI_TIMER: i32 = 0x10003;
pub const SI_ASYNCIO: i32 = 0x10004;
pub const SI_MESGQ: i32 = 0x10005;
pub type sig_fn = fn(i32);
pub const SS_ONSTACK: i32 = 0x0001;
pub const SS_DISABLE: i32 = 0x0004;
pub const MINSIGSTKSZ: i32 = 32768;
pub const SIGSTKSZ: i32 = 131_072;
#[repr(C)]
pub struct sigvec_t {
pub sv_handler: sa_handler_fn,
pub sv_mask: i32,
pub sv_flags: i32,
}
pub const SV_ONSTACK: i32 = SA_ONSTACK;
pub const SV_INTERRUPT: i32 = SA_RESTART;
pub const SV_RESETHAND: i32 = SA_RESETHAND;
pub const SV_NODEFER: i32 = SA_NODEFER;
pub const SV_NOCLDSTOP: i32 = SA_NOCLDSTOP;
pub const SV_SIGINFO: i32 = SA_SIGINFO;
#[repr(C)]
pub struct sigstack_t {
pub ss_sp: *mut c_void,
pub ss_onstack: i32,
}
#[must_use]
pub const fn sigmask(m: i32) -> i32 {
1 << (m - 1)
}
pub const BADSIG: usize = SIG_ERR;