diff --git a/include/bits/signal.h b/include/bits/signal.h index 46cc2553eda4c860054838f6c48ea5874aba25a6..57832b5e3699c5cfdfa01b4d80faf64682e5a26d 100644 --- a/include/bits/signal.h +++ b/include/bits/signal.h @@ -5,4 +5,18 @@ #define SIG_IGN ((void (*)(int))1) #define SIG_ERR ((void (*)(int))-1) +struct siginfo; +typedef struct siginfo siginfo_t; +typedef unsigned long long sigset_t; + +struct sigaction { + union { + void (*sa_handler)(int); + void (*sa_sigaction)(int, siginfo_t *, void *); + }; + unsigned long sa_flags; + void (*sa_restorer)(void); + sigset_t sa_mask; +}; + #endif // _BITS_SIGNAL_H diff --git a/src/header/signal/cbindgen.toml b/src/header/signal/cbindgen.toml index a7055988c9b80cb158b692175ce1cab9f95a2304..3c79a660734c79418f4fe0e01189b4b17a614a32 100644 --- a/src/header/signal/cbindgen.toml +++ b/src/header/signal/cbindgen.toml @@ -1,4 +1,4 @@ -sys_includes = ["stdint.h", "sys/types.h", "time.h", "bits/pthread.h"] +sys_includes = ["bits/signal.h", "stdint.h", "sys/types.h", "time.h", "bits/pthread.h"] include_guard = "_RELIBC_SIGNAL_H" trailer = "#include <bits/signal.h>" language = "C" @@ -15,3 +15,4 @@ prefix_with_name = true [export.rename] "timespec" = "struct timespec" +"sigaction" = "struct sigaction" diff --git a/src/header/signal/mod.rs b/src/header/signal/mod.rs index ec6241de54c6b98637db89413cd57c0bd0603348..01cd57d7ebb46e4b3b48f8ac4741905ebf3f54d9 100644 --- a/src/header/signal/mod.rs +++ b/src/header/signal/mod.rs @@ -35,6 +35,7 @@ pub const SIG_SETMASK: c_int = 2; #[repr(C)] #[derive(Clone, Debug)] +/// cbindgen:ignore pub struct sigaction { pub sa_handler: Option<extern "C" fn(c_int)>, pub sa_flags: c_ulong, @@ -52,7 +53,7 @@ pub struct sigaltstack { #[repr(C)] #[derive(Clone, Debug)] -pub struct siginfo_t { +pub struct siginfo { pub si_signo: c_int, pub si_errno: c_int, pub si_code: c_int, @@ -60,7 +61,10 @@ pub struct siginfo_t { _si_align: [usize; 0], } +/// cbindgen:ignore pub type sigset_t = c_ulonglong; +/// cbindgen:ignore +pub type siginfo_t = siginfo; pub type stack_t = sigaltstack;