| 1 |
//! Header: `signal.h` |
| 2 |
|
| 3 |
use super::*; |
| 4 |
use crate::prelude::*; |
| 5 |
|
| 6 |
// Standard signal numbers |
| 7 |
pub const SIGHUP: c_int = 1; |
| 8 |
pub const SIGINT: c_int = 2; |
| 9 |
pub const SIGQUIT: c_int = 3; |
| 10 |
pub const SIGILL: c_int = 4; |
| 11 |
pub const SIGTRAP: c_int = 5; |
| 12 |
pub const SIGABRT: c_int = 6; |
| 13 |
pub const SIGBUS: c_int = 7; |
| 14 |
pub const SIGFPE: c_int = 8; |
| 15 |
pub const SIGKILL: c_int = 9; |
| 16 |
pub const SIGUSR1: c_int = 10; |
| 17 |
pub const SIGSEGV: c_int = 11; |
| 18 |
pub const SIGUSR2: c_int = 12; |
| 19 |
pub const SIGPIPE: c_int = 13; |
| 20 |
pub const SIGALRM: c_int = 14; |
| 21 |
pub const SIGTERM: c_int = 15; |
| 22 |
pub const SIGSTKFLT: c_int = 16; |
| 23 |
pub const SIGCHLD: c_int = 17; |
| 24 |
pub const SIGCONT: c_int = 18; |
| 25 |
pub const SIGSTOP: c_int = 19; |
| 26 |
pub const SIGTSTP: c_int = 20; |
| 27 |
pub const SIGTTIN: c_int = 21; |
| 28 |
pub const SIGTTOU: c_int = 22; |
| 29 |
pub const SIGURG: c_int = 23; |
| 30 |
pub const SIGXCPU: c_int = 24; |
| 31 |
pub const SIGXFSZ: c_int = 25; |
| 32 |
pub const SIGVTALRM: c_int = 26; |
| 33 |
pub const SIGPROF: c_int = 27; |
| 34 |
pub const SIGWINCH: c_int = 28; |
| 35 |
pub const SIGIO: c_int = 29; |
| 36 |
pub const SIGPWR: c_int = 30; |
| 37 |
pub const SIGSYS: c_int = 31; |
| 38 |
|
| 39 |
// Signal handling constants |
| 40 |
pub const SIG_DFL: sighandler_t = 0 as sighandler_t; |
| 41 |
pub const SIG_IGN: sighandler_t = 1 as sighandler_t; |
| 42 |
pub const SIG_ERR: sighandler_t = !0 as sighandler_t; |
| 43 |
|
| 44 |
// Signal mask operations |
| 45 |
pub const SIG_BLOCK: c_int = 0; |
| 46 |
pub const SIG_UNBLOCK: c_int = 1; |
| 47 |
pub const SIG_SETMASK: c_int = 2; |
| 48 |
|
| 49 |
pub type sighandler_t = size_t; |
| 50 |
|
| 51 |
extern "C" { |
| 52 |
pub fn signal(sig: c_int, handler: sighandler_t) -> sighandler_t; |
| 53 |
pub fn kill(pid: pid_t, sig: c_int) -> c_int; |
| 54 |
pub fn raise(sig: c_int) -> c_int; |
| 55 |
pub fn alarm(seconds: c_uint) -> c_uint; |
| 56 |
pub fn pause() -> c_int; |
| 57 |
|
| 58 |
// Signal mask functions |
| 59 |
pub fn sigemptyset(set: *mut sigset_t) -> c_int; |
| 60 |
pub fn sigfillset(set: *mut sigset_t) -> c_int; |
| 61 |
pub fn sigaddset(set: *mut sigset_t, signum: c_int) -> c_int; |
| 62 |
pub fn sigdelset(set: *mut sigset_t, signum: c_int) -> c_int; |
| 63 |
pub fn sigismember(set: *const sigset_t, signum: c_int) -> c_int; |
| 64 |
pub fn sigprocmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int; |
| 65 |
pub fn sigpending(set: *mut sigset_t) -> c_int; |
| 66 |
pub fn sigsuspend(mask: *const sigset_t) -> c_int; |
| 67 |
} |