#![allow(clippy::module_name_repetitions)]
#![allow(clippy::uninlined_format_args)]
use core::fmt;
use core::mem::size_of;
use crate::{clock_t, pid_t, timer_t, uid_t};
#[repr(C)]
#[derive(Clone, Copy)]
pub union sigval_t {
pub sival_int: i32,
pub sival_ptr: usize,
}
impl fmt::Debug for sigval_t {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let val = unsafe { self.sival_ptr };
write!(f, "sigval_t: {}", val)
}
}
impl Default for sigval_t {
fn default() -> Self {
Self { sival_ptr: 0 }
}
}
pub const SI_MAX_SIZE: usize = 128;
pub type arch_si_band_t = isize;
pub type arch_si_clock_t = clock_t;
#[repr(C)]
#[derive(Debug, Default, Clone, Copy)]
pub struct si_kill_t {
pub pid: pid_t,
pub uid: uid_t,
}
#[repr(C)]
#[derive(Debug, Default, Clone, Copy)]
pub struct si_timer_t {
pub tid: timer_t,
pub overrun: i32,
pub sigval: sigval_t,
sys_private: i32,
}
#[repr(C)]
#[derive(Debug, Default, Clone, Copy)]
pub struct si_rt_t {
pub pid: pid_t,
pub uid: uid_t,
pub sigval: sigval_t,
}
#[repr(C)]
#[derive(Debug, Default, Clone, Copy)]
pub struct si_sigchld_t {
pub pid: pid_t,
pub uid: uid_t,
pub status: i32,
pub utime: arch_si_clock_t,
pub stime: arch_si_clock_t,
}
#[repr(C)]
#[derive(Debug, Default, Clone, Copy)]
pub struct si_sigpoll_t {
pub band: arch_si_band_t,
pub fd: i32,
}
#[repr(C)]
#[derive(Debug, Default, Clone, Copy)]
pub struct si_sigsys_t {
pub call_addr: usize,
pub syscall: i32,
pub arch: u32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union sifields_t {
pub kill: si_kill_t,
pub timer: si_timer_t,
pub rt: si_rt_t,
pub sigchld: si_sigchld_t,
pub sigpoll: si_sigpoll_t,
pub sigsys: si_sigsys_t,
}
impl Default for sifields_t {
fn default() -> Self {
Self {
rt: si_rt_t::default(),
}
}
}
#[repr(C)]
#[derive(Default, Clone, Copy)]
pub struct siginfo_intern_t {
pub si_signo: i32,
pub si_errno: i32,
pub si_code: i32,
pub sifields: sifields_t,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union siginfo_t {
pub siginfo: siginfo_intern_t,
si_pad: [u8; SI_MAX_SIZE / size_of::<i32>()],
}
impl Default for siginfo_t {
fn default() -> Self {
Self {
si_pad: [0; SI_MAX_SIZE / size_of::<i32>()],
}
}
}
pub const SI_USER: i32 = 0;
pub const SI_KERNEL: i32 = 0x80;
pub const SI_QUEUE: i32 = -1;
pub const SI_TIMER: i32 = -2;
pub const SI_MESGQ: i32 = -3;
pub const SI_ASYNCIO: i32 = -4;
pub const SI_SIGIO: i32 = -5;
pub const SI_TKILL: i32 = -6;
pub const SI_DETHREAD: i32 = -7;
pub const SI_ASYNCNL: i32 = -60;
pub const ILL_ILLOPC: i32 = 1;
pub const ILL_ILLOPN: i32 = 2;
pub const ILL_ILLADR: i32 = 3;
pub const ILL_ILLTRP: i32 = 4;
pub const ILL_PRVOPC: i32 = 5;
pub const ILL_PRVREG: i32 = 6;
pub const ILL_COPROC: i32 = 7;
pub const ILL_BADSTK: i32 = 8;
pub const ILL_BADIADDR: i32 = 9;
pub const __ILL_BREAK: i32 = 10;
pub const __ILL_BNDMOD: i32 = 11;
pub const NSIGILL: i32 = 11;
pub const FPE_INTDIV: i32 = 1;
pub const FPE_INTOVF: i32 = 2;
pub const FPE_FLTDIV: i32 = 3;
pub const FPE_FLTOVF: i32 = 4;
pub const FPE_FLTUND: i32 = 5;
pub const FPE_FLTRES: i32 = 6;
pub const FPE_FLTINV: i32 = 7;
pub const FPE_FLTSUB: i32 = 8;
pub const __FPE_DECOVF: i32 = 9;
pub const __FPE_DECDIV: i32 = 10;
pub const __FPE_DECERR: i32 = 11;
pub const __FPE_INVASC: i32 = 12;
pub const __FPE_INVDEC: i32 = 13;
pub const FPE_FLTUNK: i32 = 14;
pub const FPE_CONDTRAP: i32 = 15;
pub const NSIGFPE: i32 = 15;
pub const SEGV_MAPERR: i32 = 1;
pub const SEGV_ACCERR: i32 = 2;
pub const SEGV_BNDERR: i32 = 3;
pub const SEGV_PKUERR: i32 = 4;
pub const SEGV_ACCADI: i32 = 5;
pub const SEGV_ADIDERR: i32 = 6;
pub const SEGV_ADIPERR: i32 = 7;
pub const NSIGSEGV: i32 = 7;
pub const BUS_ADRALN: i32 = 1;
pub const BUS_ADRERR: i32 = 2;
pub const BUS_OBJERR: i32 = 3;
pub const BUS_MCEERR_AR: i32 = 4;
pub const BUS_MCEERR_AO: i32 = 5;
pub const NSIGBUS: i32 = 5;
pub const TRAP_BRKPT: i32 = 1;
pub const TRAP_TRACE: i32 = 2;
pub const TRAP_BRANCH: i32 = 3;
pub const TRAP_HWBKPT: i32 = 4;
pub const TRAP_UNK: i32 = 5;
pub const NSIGTRAP: i32 = 5;
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 NSIGCHLD: 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 const NSIGPOLL: i32 = 6;
pub const SYS_SECCOMP_: i32 = 1;
pub const NSIGSYS: i32 = 1;
pub const EMT_TAGOVF: i32 = 1;
pub const NSIGEMT: i32 = 1;
pub const SIGEV_SIGNAL: i32 = 0;
pub const SIGEV_NONE: i32 = 1;
pub const SIGEV_THREAD: i32 = 2;
pub const SIGEV_THREAD_ID: i32 = 4;
const ARCH_SIGEV_PREAMBLE_SIZE: usize = size_of::<i32>() * 2 + size_of::<sigval_t>();
pub const SIGEV_MAX_SIZE: usize = 64;
pub const SIGEV_PAD_SIZE: usize = (SIGEV_MAX_SIZE - ARCH_SIGEV_PREAMBLE_SIZE) / size_of::<i32>();
#[repr(C)]
#[derive(Debug, Default, Clone, Copy)]
pub struct sigev_thread_t {
pub function: usize,
pub attribute: usize,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union sigev_un_t {
pad: [i32; SIGEV_PAD_SIZE],
pub tid: i32,
pub sigev_thread: sigev_thread_t,
}
impl Default for sigev_un_t {
fn default() -> Self {
Self {
pad: [0; SIGEV_PAD_SIZE],
}
}
}
impl fmt::Debug for sigev_un_t {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let tid = unsafe { self.tid };
write!(f, "sigev_un_t.tid = {}", tid)
}
}
#[repr(C)]
#[derive(Default, Debug, Clone)]
pub struct sigevent_t {
pub sigev_value: sigval_t,
pub sigev_signo: i32,
pub sigev_notify: i32,
pub sigev_un: sigev_un_t,
}