| 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 |
pub const SIGRTMAX: c_int = 31; |
| 60 |
pub const SIGXCPU: c_int = 24; |
| 61 |
pub const SIGXFSZ: c_int = 25; |
| 62 |
pub const SIGVTALRM: c_int = 26; |
| 63 |
pub const SIGPROF: c_int = 27; |
| 64 |
|
| 65 |
pub const SA_NOCLDSTOP: c_ulong = 0x00000001; |
| 66 |
pub const SA_SIGINFO: c_ulong = 0x00000002; |
| 67 |
pub const SA_ONSTACK: c_ulong = 0x00000004; |
| 68 |
|
| 69 |
pub const EAI_AGAIN: c_int = 2; |
| 70 |
pub const EAI_BADFLAGS: c_int = 3; |
| 71 |
pub const EAI_FAIL: c_int = 4; |
| 72 |
pub const EAI_SERVICE: c_int = 9; |
| 73 |
pub const EAI_SYSTEM: c_int = 11; |
| 74 |
pub const EAI_OVERFLOW: c_int = 14; |
| 75 |
|
| 76 |
pub const _SC_PAGESIZE: c_int = 8; |
| 77 |
pub const _SC_GETPW_R_SIZE_MAX: c_int = 51; |
| 78 |
pub const PTHREAD_STACK_MIN: size_t = 0; |
| 79 |
|
| 80 |
// sys/wait.h |
| 81 |
pub const WNOHANG: c_int = 1; |
| 82 |
pub const WUNTRACED: c_int = 2; |
| 83 |
|
| 84 |
// sys/socket.h |
| 85 |
pub const SOMAXCONN: c_int = 128; |
| 86 |
|
| 87 |
safe_f! { |
| 88 |
pub {const} fn WIFSTOPPED(status: c_int) -> bool { |
| 89 |
(status & 0xff) == 0x7f |
| 90 |
} |
| 91 |
|
| 92 |
pub {const} fn WSTOPSIG(status: c_int) -> c_int { |
| 93 |
// (status >> 8) & 0xff |
| 94 |
WEXITSTATUS(status) |
| 95 |
} |
| 96 |
|
| 97 |
pub {const} fn WIFSIGNALED(status: c_int) -> bool { |
| 98 |
((status & 0x7f) > 0) && ((status & 0x7f) < 0x7f) |
| 99 |
} |
| 100 |
|
| 101 |
pub {const} fn WTERMSIG(status: c_int) -> c_int { |
| 102 |
status & 0x7f |
| 103 |
} |
| 104 |
|
| 105 |
pub {const} fn WIFEXITED(status: c_int) -> bool { |
| 106 |
(status & 0xff) == 0 |
| 107 |
} |
| 108 |
|
| 109 |
pub {const} fn WEXITSTATUS(status: c_int) -> c_int { |
| 110 |
(status >> 8) & 0xff |
| 111 |
} |
| 112 |
|
| 113 |
// RTEMS doesn't have native WIFCONTINUED. |
| 114 |
pub {const} fn WIFCONTINUED(_status: c_int) -> bool { |
| 115 |
true |
| 116 |
} |
| 117 |
|
| 118 |
// RTEMS doesn't have native WCOREDUMP. |
| 119 |
pub {const} fn WCOREDUMP(_status: c_int) -> bool { |
| 120 |
false |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
extern "C" { |
| 125 |
pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int; |
| 126 |
pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t; |
| 127 |
pub fn readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t; |
| 128 |
|
| 129 |
pub fn pthread_create( |
| 130 |
native: *mut crate::pthread_t, |
| 131 |
attr: *const crate::pthread_attr_t, |
| 132 |
f: extern "C" fn(_: *mut c_void) -> *mut c_void, |
| 133 |
value: *mut c_void, |
| 134 |
) -> c_int; |
| 135 |
|
| 136 |
pub fn pthread_condattr_setclock( |
| 137 |
attr: *mut crate::pthread_condattr_t, |
| 138 |
clock_id: crate::clockid_t, |
| 139 |
) -> c_int; |
| 140 |
|
| 141 |
pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int; |
| 142 |
|
| 143 |
pub fn arc4random_buf(buf: *mut core::ffi::c_void, nbytes: size_t); |
| 144 |
|
| 145 |
pub fn setgroups(ngroups: c_int, grouplist: *const crate::gid_t) -> c_int; |
| 146 |
} |