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