Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/libc/src/new/qurt/signal.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / libc / src / new / qurt / signal.rs` 119 lines ยท 3644 bytes Raw Blame History 1 //! Header: `signal.h` 2 3 use super::*; 4 use crate::prelude::*; 5 6 // Signal numbers from toolchain signal.h (non-_LINUX_C_LIB_H_ path) 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 SIGIOT: c_int = 6; 14 pub const SIGBUS: c_int = 7; 15 pub const SIGFPE: c_int = 8; 16 pub const SIGKILL: c_int = 9; 17 pub const SIGUSR1: c_int = 10; 18 pub const SIGSEGV: c_int = 11; 19 pub const SIGUSR2: c_int = 12; 20 pub const SIGPIPE: c_int = 13; 21 pub const SIGALRM: c_int = 14; 22 pub const SIGTERM: c_int = 15; 23 pub const SIGSTKFLT: c_int = 16; 24 pub const SIGCHLD: c_int = 17; 25 pub const SIGCONT: c_int = 18; 26 pub const SIGSTOP: c_int = 19; 27 pub const SIGTSTP: c_int = 20; 28 pub const SIGTTIN: c_int = 21; 29 pub const SIGTTOU: c_int = 22; 30 pub const SIGURG: c_int = 23; 31 pub const SIGXCPU: c_int = 24; 32 pub const SIGXFSZ: c_int = 25; 33 pub const SIGPROF: c_int = 27; 34 pub const SIGWINCH: c_int = 28; 35 pub const SIGPOLL: c_int = 29; 36 pub const SIGIO: c_int = 29; 37 pub const SIGPWR: c_int = 30; 38 pub const SIGSYS: c_int = 31; 39 40 // Signal handling constants 41 pub const SIG_DFL: sighandler_t = 0 as sighandler_t; 42 pub const SIG_IGN: sighandler_t = 1 as sighandler_t; 43 pub const SIG_ERR: sighandler_t = !0 as sighandler_t; 44 45 // Signal mask operations (QuRT uses different values than Linux) 46 pub const SIG_BLOCK: c_int = 1; 47 pub const SIG_UNBLOCK: c_int = 2; 48 pub const SIG_SETMASK: c_int = 3; 49 50 // QuRT-specific signal constants 51 pub const POSIX_MSG: c_int = 7; 52 pub const POSIX_NOTIF: c_int = 8; 53 pub const SIGRTMIN: c_int = 10; 54 55 /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) 56 /// for details. 57 pub const SIGRTMAX: c_int = 32; 58 59 // Notification types (from QuRT signal.h) 60 pub const SIGEV_NONE: c_int = 0; 61 pub const SIGEV_SIGNAL: c_int = 1; 62 pub const SIGEV_THREAD: c_int = 2; 63 pub const SA_SIGINFO: c_int = 1; 64 65 pub type sighandler_t = size_t; 66 67 // Signal structures based on QuRT SDK headers 68 69 // sigval is a union in C (4 bytes on 32-bit hexagon) 70 s_no_extra_traits! { 71 pub union sigval { 72 pub sival_int: c_int, 73 pub sival_ptr: *mut c_void, 74 } 75 } 76 77 s! { 78 pub struct sigevent { 79 pub sigev_notify: c_int, 80 pub sigev_signo: c_int, 81 pub sigev_value: sigval, 82 pub sigev_notify_function: Option, 83 pub sigev_notify_attributes: *mut pthread_attr_t, 84 } 85 86 pub struct siginfo_t { 87 pub si_signo: c_int, 88 pub si_code: c_int, 89 pub si_value: sigval, 90 } 91 92 pub struct sigaction { 93 pub sa_handler: Option, 94 pub sa_mask: sigset_t, 95 pub sa_flags: c_int, 96 pub sa_sigaction: Option, 97 } 98 } 99 100 extern "C" { 101 // From generic signal.h (toolchain) 102 pub fn signal(sig: c_int, handler: sighandler_t) -> sighandler_t; 103 pub fn raise(sig: c_int) -> c_int; 104 105 // QuRT POSIX signal functions 106 pub fn sigemptyset(set: *mut sigset_t) -> c_int; 107 pub fn sigfillset(set: *mut sigset_t) -> c_int; 108 pub fn sigaddset(set: *mut sigset_t, signum: c_int) -> c_int; 109 pub fn sigdelset(set: *mut sigset_t, signum: c_int) -> c_int; 110 pub fn sigismember(set: *const sigset_t, signum: c_int) -> c_int; 111 pub fn sigsuspend(mask: *const sigset_t) -> c_int; 112 pub fn sigwait(set: *const sigset_t, sig: *mut c_int) -> c_int; 113 pub fn _sigaction(sig: c_int, act: *const sigaction, oact: *mut sigaction) -> c_int; 114 pub fn sigtimedwait( 115 set: *const sigset_t, 116 info: *mut siginfo_t, 117 timeout: *const timespec, 118 ) -> c_int; 119 }