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/unix/newlib/rtems/mod.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 / unix / newlib / rtems / mod.rs` 148 lines ยท 4035 bytes Raw Blame History 1 // defined in architecture specific module 2 3 use crate::prelude::*; 4 5 s! { 6 pub struct sockaddr_un { 7 pub sun_family: crate::sa_family_t, 8 pub sun_path: [c_char; 108usize], 9 } 10 } 11 12 pub const AF_UNIX: c_int = 1; 13 14 pub const RTLD_DEFAULT: *mut c_void = -2isize as *mut c_void; 15 16 pub const UTIME_OMIT: c_long = -1; 17 pub const AT_FDCWD: c_int = -2; 18 19 pub const O_DIRECTORY: c_int = 0x200000; 20 pub const O_NOFOLLOW: c_int = 0x100000; 21 22 pub const AT_EACCESS: c_int = 1; 23 pub const AT_SYMLINK_NOFOLLOW: c_int = 2; 24 pub const AT_SYMLINK_FOLLOW: c_int = 4; 25 pub const AT_REMOVEDIR: c_int = 8; 26 27 // signal.h 28 pub const SIG_BLOCK: c_int = 1; 29 pub const SIG_UNBLOCK: c_int = 2; 30 pub const SIG_SETMASK: c_int = 0; 31 pub const SIGHUP: c_int = 1; 32 pub const SIGINT: c_int = 2; 33 pub const SIGQUIT: c_int = 3; 34 pub const SIGILL: c_int = 4; 35 pub const SIGTRAP: c_int = 5; 36 pub const SIGABRT: c_int = 6; 37 pub const SIGEMT: c_int = 7; 38 pub const SIGFPE: c_int = 8; 39 pub const SIGKILL: c_int = 9; 40 pub const SIGBUS: c_int = 10; 41 pub const SIGSEGV: c_int = 11; 42 pub const SIGSYS: c_int = 12; 43 pub const SIGPIPE: c_int = 13; 44 pub const SIGALRM: c_int = 14; 45 pub const SIGTERM: c_int = 15; 46 pub const SIGURG: c_int = 16; 47 pub const SIGSTOP: c_int = 17; 48 pub const SIGTSTP: c_int = 18; 49 pub const SIGCONT: c_int = 19; 50 pub const SIGCHLD: c_int = 20; 51 pub const SIGCLD: c_int = 20; 52 pub const SIGTTIN: c_int = 21; 53 pub const SIGTTOU: c_int = 22; 54 pub const SIGIO: c_int = 23; 55 pub const SIGWINCH: c_int = 24; 56 pub const SIGUSR1: c_int = 25; 57 pub const SIGUSR2: c_int = 26; 58 pub const SIGRTMIN: c_int = 27; 59 60 /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) 61 /// for details. 62 pub const SIGRTMAX: c_int = 31; 63 64 pub const SIGXCPU: c_int = 24; 65 pub const SIGXFSZ: c_int = 25; 66 pub const SIGVTALRM: c_int = 26; 67 pub const SIGPROF: c_int = 27; 68 69 pub const SA_NOCLDSTOP: c_ulong = 0x00000001; 70 pub const SA_SIGINFO: c_ulong = 0x00000002; 71 pub const SA_ONSTACK: c_ulong = 0x00000004; 72 73 pub const EAI_AGAIN: c_int = 2; 74 pub const EAI_BADFLAGS: c_int = 3; 75 pub const EAI_FAIL: c_int = 4; 76 pub const EAI_SERVICE: c_int = 9; 77 pub const EAI_SYSTEM: c_int = 11; 78 pub const EAI_OVERFLOW: c_int = 14; 79 80 pub const PTHREAD_STACK_MIN: size_t = 0; 81 82 // sys/wait.h 83 pub const WNOHANG: c_int = 1; 84 pub const WUNTRACED: c_int = 2; 85 86 // sys/socket.h 87 pub const SOMAXCONN: c_int = 128; 88 89 safe_f! { 90 pub const safe fn WIFSTOPPED(status: c_int) -> bool { 91 (status & 0xff) == 0x7f 92 } 93 94 pub const safe fn WSTOPSIG(status: c_int) -> c_int { 95 // (status >> 8) & 0xff 96 WEXITSTATUS(status) 97 } 98 99 pub const safe fn WIFSIGNALED(status: c_int) -> bool { 100 ((status & 0x7f) > 0) && ((status & 0x7f) < 0x7f) 101 } 102 103 pub const safe fn WTERMSIG(status: c_int) -> c_int { 104 status & 0x7f 105 } 106 107 pub const safe fn WIFEXITED(status: c_int) -> bool { 108 (status & 0xff) == 0 109 } 110 111 pub const safe fn WEXITSTATUS(status: c_int) -> c_int { 112 (status >> 8) & 0xff 113 } 114 115 // RTEMS doesn't have native WIFCONTINUED. 116 pub const safe fn WIFCONTINUED(_status: c_int) -> bool { 117 true 118 } 119 120 // RTEMS doesn't have native WCOREDUMP. 121 pub const safe fn WCOREDUMP(_status: c_int) -> bool { 122 false 123 } 124 } 125 126 extern "C" { 127 pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int; 128 pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t; 129 pub fn readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t; 130 131 pub fn pthread_create( 132 native: *mut crate::pthread_t, 133 attr: *const crate::pthread_attr_t, 134 f: extern "C" fn(_: *mut c_void) -> *mut c_void, 135 value: *mut c_void, 136 ) -> c_int; 137 138 pub fn pthread_condattr_setclock( 139 attr: *mut crate::pthread_condattr_t, 140 clock_id: crate::clockid_t, 141 ) -> c_int; 142 143 pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int; 144 145 pub fn arc4random_buf(buf: *mut core::ffi::c_void, nbytes: size_t); 146 147 pub fn setgroups(ngroups: c_int, grouplist: *const crate::gid_t) -> c_int; 148 }