Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 1 | use dox::mem; |
| 2 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 3 | pub type sa_family_t = u16; |
Alex Crichton | 239f9cd | 2015-09-18 16:31:34 -0700 | [diff] [blame] | 4 | pub type pthread_key_t = ::c_uint; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 5 | pub type speed_t = ::c_uint; |
| 6 | pub type tcflag_t = ::c_uint; |
Kamal Marhubi | 0cfc25f | 2016-02-04 15:57:10 -0500 | [diff] [blame] | 7 | pub type loff_t = ::c_longlong; |
NODA, Kai | 7e752a3 | 2016-03-31 18:59:05 +0800 | [diff] [blame] | 8 | pub type clockid_t = ::c_int; |
Raphael Cohn | fabef1d | 2016-05-19 14:28:40 +0100 | [diff] [blame] | 9 | pub type id_t = ::c_uint; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 10 | |
| 11 | pub enum timezone {} |
| 12 | |
| 13 | s! { |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 14 | pub struct sockaddr { |
| 15 | pub sa_family: sa_family_t, |
Alex Crichton | f3b9748 | 2015-09-16 14:13:20 -0700 | [diff] [blame] | 16 | pub sa_data: [::c_char; 14], |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 17 | } |
| 18 | |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 19 | pub struct sockaddr_in { |
| 20 | pub sin_family: sa_family_t, |
| 21 | pub sin_port: ::in_port_t, |
| 22 | pub sin_addr: ::in_addr, |
| 23 | pub sin_zero: [u8; 8], |
| 24 | } |
| 25 | |
| 26 | pub struct sockaddr_in6 { |
| 27 | pub sin6_family: sa_family_t, |
| 28 | pub sin6_port: ::in_port_t, |
| 29 | pub sin6_flowinfo: u32, |
| 30 | pub sin6_addr: ::in6_addr, |
| 31 | pub sin6_scope_id: u32, |
| 32 | } |
| 33 | |
| 34 | pub struct sockaddr_un { |
| 35 | pub sun_family: sa_family_t, |
| 36 | pub sun_path: [::c_char; 108] |
| 37 | } |
| 38 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 39 | pub struct sockaddr_storage { |
| 40 | pub ss_family: sa_family_t, |
Alex Crichton | f3b9748 | 2015-09-16 14:13:20 -0700 | [diff] [blame] | 41 | __ss_align: ::size_t, |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 42 | #[cfg(target_pointer_width = "32")] |
| 43 | __ss_pad2: [u8; 128 - 2 * 4], |
| 44 | #[cfg(target_pointer_width = "64")] |
| 45 | __ss_pad2: [u8; 128 - 2 * 8], |
| 46 | } |
| 47 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 48 | pub struct addrinfo { |
Alex Crichton | 239f9cd | 2015-09-18 16:31:34 -0700 | [diff] [blame] | 49 | pub ai_flags: ::c_int, |
| 50 | pub ai_family: ::c_int, |
| 51 | pub ai_socktype: ::c_int, |
| 52 | pub ai_protocol: ::c_int, |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 53 | pub ai_addrlen: socklen_t, |
| 54 | |
Brian Anderson | 7d1d575 | 2015-11-26 23:27:45 +0000 | [diff] [blame] | 55 | #[cfg(any(target_os = "linux", target_os = "emscripten"))] |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 56 | pub ai_addr: *mut ::sockaddr, |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 57 | |
| 58 | pub ai_canonname: *mut c_char, |
| 59 | |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 60 | #[cfg(target_os = "android")] |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 61 | pub ai_addr: *mut ::sockaddr, |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 62 | |
| 63 | pub ai_next: *mut addrinfo, |
| 64 | } |
| 65 | |
Paul Osborne | 9e94d5b | 2016-03-12 00:13:31 -0600 | [diff] [blame] | 66 | pub struct sockaddr_nl { |
| 67 | pub nl_family: ::sa_family_t, |
| 68 | nl_pad: ::c_ushort, |
| 69 | pub nl_pid: u32, |
| 70 | pub nl_groups: u32 |
| 71 | } |
| 72 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 73 | pub struct sockaddr_ll { |
Alex Crichton | 239f9cd | 2015-09-18 16:31:34 -0700 | [diff] [blame] | 74 | pub sll_family: ::c_ushort, |
| 75 | pub sll_protocol: ::c_ushort, |
| 76 | pub sll_ifindex: ::c_int, |
| 77 | pub sll_hatype: ::c_ushort, |
| 78 | pub sll_pkttype: ::c_uchar, |
| 79 | pub sll_halen: ::c_uchar, |
| 80 | pub sll_addr: [::c_uchar; 8] |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 81 | } |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 82 | |
| 83 | pub struct fd_set { |
| 84 | fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], |
| 85 | } |
Alex Crichton | 568705e | 2015-11-03 14:18:52 -0800 | [diff] [blame] | 86 | |
| 87 | pub struct tm { |
| 88 | pub tm_sec: ::c_int, |
| 89 | pub tm_min: ::c_int, |
| 90 | pub tm_hour: ::c_int, |
| 91 | pub tm_mday: ::c_int, |
| 92 | pub tm_mon: ::c_int, |
| 93 | pub tm_year: ::c_int, |
| 94 | pub tm_wday: ::c_int, |
| 95 | pub tm_yday: ::c_int, |
| 96 | pub tm_isdst: ::c_int, |
| 97 | pub tm_gmtoff: ::c_long, |
| 98 | pub tm_zone: *const ::c_char, |
| 99 | } |
Alexander Polakov | e09951c | 2015-11-26 14:00:03 +0300 | [diff] [blame] | 100 | |
| 101 | pub struct sched_param { |
| 102 | pub sched_priority: ::c_int, |
Timon Van Overveldt | ad72859 | 2015-12-26 06:13:31 -0800 | [diff] [blame] | 103 | #[cfg(any(target_env = "musl", |
| 104 | target_env = "musleabi", |
| 105 | target_env = "musleabihf"))] |
Alexander Polakov | e09951c | 2015-11-26 14:00:03 +0300 | [diff] [blame] | 106 | pub sched_ss_low_priority: ::c_int, |
Timon Van Overveldt | ad72859 | 2015-12-26 06:13:31 -0800 | [diff] [blame] | 107 | #[cfg(any(target_env = "musl", |
| 108 | target_env = "musleabi", |
| 109 | target_env = "musleabihf"))] |
Alexander Polakov | e09951c | 2015-11-26 14:00:03 +0300 | [diff] [blame] | 110 | pub sched_ss_repl_period: ::timespec, |
Timon Van Overveldt | ad72859 | 2015-12-26 06:13:31 -0800 | [diff] [blame] | 111 | #[cfg(any(target_env = "musl", |
| 112 | target_env = "musleabi", |
| 113 | target_env = "musleabihf"))] |
Alexander Polakov | e09951c | 2015-11-26 14:00:03 +0300 | [diff] [blame] | 114 | pub sched_ss_init_budget: ::timespec, |
Timon Van Overveldt | ad72859 | 2015-12-26 06:13:31 -0800 | [diff] [blame] | 115 | #[cfg(any(target_env = "musl", |
| 116 | target_env = "musleabi", |
| 117 | target_env = "musleabihf"))] |
Alexander Polakov | e09951c | 2015-11-26 14:00:03 +0300 | [diff] [blame] | 118 | pub sched_ss_max_repl: ::c_int, |
| 119 | } |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 120 | |
| 121 | pub struct Dl_info { |
| 122 | pub dli_fname: *const ::c_char, |
| 123 | pub dli_fbase: *mut ::c_void, |
| 124 | pub dli_sname: *const ::c_char, |
| 125 | pub dli_saddr: *mut ::c_void, |
| 126 | } |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 127 | |
Brian Anderson | 773aab8 | 2015-12-29 20:00:29 +0000 | [diff] [blame] | 128 | #[cfg_attr(any(all(target_arch = "x86", not(target_env = "musl")), |
| 129 | target_arch = "x86_64"), |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 130 | repr(packed))] |
| 131 | pub struct epoll_event { |
| 132 | pub events: ::uint32_t, |
| 133 | pub u64: ::uint64_t, |
| 134 | } |
| 135 | |
| 136 | pub struct utsname { |
| 137 | pub sysname: [::c_char; 65], |
| 138 | pub nodename: [::c_char; 65], |
| 139 | pub release: [::c_char; 65], |
| 140 | pub version: [::c_char; 65], |
| 141 | pub machine: [::c_char; 65], |
| 142 | pub domainname: [::c_char; 65] |
| 143 | } |
A.J. Gardner | 874852c | 2016-03-30 19:59:47 -0500 | [diff] [blame] | 144 | |
| 145 | pub struct lconv { |
| 146 | pub decimal_point: *mut ::c_char, |
| 147 | pub thousands_sep: *mut ::c_char, |
| 148 | pub grouping: *mut ::c_char, |
| 149 | pub int_curr_symbol: *mut ::c_char, |
| 150 | pub currency_symbol: *mut ::c_char, |
| 151 | pub mon_decimal_point: *mut ::c_char, |
| 152 | pub mon_thousands_sep: *mut ::c_char, |
| 153 | pub mon_grouping: *mut ::c_char, |
| 154 | pub positive_sign: *mut ::c_char, |
| 155 | pub negative_sign: *mut ::c_char, |
| 156 | pub int_frac_digits: ::c_char, |
| 157 | pub frac_digits: ::c_char, |
| 158 | pub p_cs_precedes: ::c_char, |
| 159 | pub p_sep_by_space: ::c_char, |
| 160 | pub n_cs_precedes: ::c_char, |
| 161 | pub n_sep_by_space: ::c_char, |
| 162 | pub p_sign_posn: ::c_char, |
| 163 | pub n_sign_posn: ::c_char, |
| 164 | pub int_p_cs_precedes: ::c_char, |
| 165 | pub int_p_sep_by_space: ::c_char, |
| 166 | pub int_n_cs_precedes: ::c_char, |
| 167 | pub int_n_sep_by_space: ::c_char, |
| 168 | pub int_p_sign_posn: ::c_char, |
| 169 | pub int_n_sign_posn: ::c_char, |
| 170 | } |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 171 | } |
| 172 | |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 173 | // intentionally not public, only used for fd_set |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 174 | cfg_if! { |
| 175 | if #[cfg(target_pointer_width = "32")] { |
| 176 | const ULONG_SIZE: usize = 32; |
| 177 | } else if #[cfg(target_pointer_width = "64")] { |
| 178 | const ULONG_SIZE: usize = 64; |
| 179 | } else { |
Kamal Marhubi | 66c3375 | 2016-03-10 15:07:32 -0500 | [diff] [blame] | 180 | // Unknown target_pointer_width |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 181 | } |
| 182 | } |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 183 | |
Alex Crichton | 239f9cd | 2015-09-18 16:31:34 -0700 | [diff] [blame] | 184 | pub const EXIT_FAILURE: ::c_int = 1; |
| 185 | pub const EXIT_SUCCESS: ::c_int = 0; |
| 186 | pub const RAND_MAX: ::c_int = 2147483647; |
| 187 | pub const EOF: ::c_int = -1; |
| 188 | pub const SEEK_SET: ::c_int = 0; |
| 189 | pub const SEEK_CUR: ::c_int = 1; |
| 190 | pub const SEEK_END: ::c_int = 2; |
| 191 | pub const _IOFBF: ::c_int = 0; |
| 192 | pub const _IONBF: ::c_int = 2; |
| 193 | pub const _IOLBF: ::c_int = 1; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 194 | |
Alex Crichton | 239f9cd | 2015-09-18 16:31:34 -0700 | [diff] [blame] | 195 | pub const F_DUPFD: ::c_int = 0; |
| 196 | pub const F_GETFD: ::c_int = 1; |
| 197 | pub const F_SETFD: ::c_int = 2; |
| 198 | pub const F_GETFL: ::c_int = 3; |
| 199 | pub const F_SETFL: ::c_int = 4; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 200 | |
Kamal Marhubi | b43118c | 2016-03-17 14:29:00 -0400 | [diff] [blame] | 201 | // Linux-specific fcntls |
| 202 | pub const F_SETLEASE: ::c_int = 1024; |
| 203 | pub const F_GETLEASE: ::c_int = 1025; |
| 204 | pub const F_NOTIFY: ::c_int = 1026; |
| 205 | pub const F_DUPFD_CLOEXEC: ::c_int = 1030; |
| 206 | pub const F_SETPIPE_SZ: ::c_int = 1031; |
| 207 | pub const F_GETPIPE_SZ: ::c_int = 1032; |
| 208 | |
| 209 | // TODO(#235): Include file sealing fcntls once we have a way to verify them. |
| 210 | |
Alex Crichton | 239f9cd | 2015-09-18 16:31:34 -0700 | [diff] [blame] | 211 | pub const SIGTRAP: ::c_int = 5; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 212 | |
Alex Crichton | 239f9cd | 2015-09-18 16:31:34 -0700 | [diff] [blame] | 213 | pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; |
| 214 | pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 215 | |
NODA, Kai | 7e752a3 | 2016-03-31 18:59:05 +0800 | [diff] [blame] | 216 | pub const CLOCK_REALTIME: clockid_t = 0; |
| 217 | pub const CLOCK_MONOTONIC: clockid_t = 1; |
| 218 | pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2; |
| 219 | pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3; |
| 220 | pub const CLOCK_MONOTONIC_RAW: clockid_t = 4; |
| 221 | pub const CLOCK_REALTIME_COARSE: clockid_t = 5; |
| 222 | pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6; |
| 223 | pub const CLOCK_BOOTTIME: clockid_t = 7; |
| 224 | pub const CLOCK_REALTIME_ALARM: clockid_t = 8; |
| 225 | pub const CLOCK_BOOTTIME_ALARM: clockid_t = 9; |
| 226 | // TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep |
| 227 | // 2014.) See also musl/mod.rs |
| 228 | // pub const CLOCK_SGI_CYCLE: clockid_t = 10; |
| 229 | // pub const CLOCK_TAI: clockid_t = 11; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 230 | |
Alex Crichton | 239f9cd | 2015-09-18 16:31:34 -0700 | [diff] [blame] | 231 | pub const RLIMIT_CPU: ::c_int = 0; |
| 232 | pub const RLIMIT_FSIZE: ::c_int = 1; |
| 233 | pub const RLIMIT_DATA: ::c_int = 2; |
| 234 | pub const RLIMIT_STACK: ::c_int = 3; |
| 235 | pub const RLIMIT_CORE: ::c_int = 4; |
| 236 | pub const RLIMIT_LOCKS: ::c_int = 10; |
| 237 | pub const RLIMIT_SIGPENDING: ::c_int = 11; |
| 238 | pub const RLIMIT_MSGQUEUE: ::c_int = 12; |
| 239 | pub const RLIMIT_NICE: ::c_int = 13; |
| 240 | pub const RLIMIT_RTPRIO: ::c_int = 14; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 241 | |
Alex Crichton | 239f9cd | 2015-09-18 16:31:34 -0700 | [diff] [blame] | 242 | pub const RUSAGE_SELF: ::c_int = 0; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 243 | |
| 244 | pub const O_RDONLY: ::c_int = 0; |
| 245 | pub const O_WRONLY: ::c_int = 1; |
| 246 | pub const O_RDWR: ::c_int = 2; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 247 | pub const O_TRUNC: ::c_int = 512; |
Alex Crichton | 14f7e02 | 2015-11-02 14:21:30 -0800 | [diff] [blame] | 248 | pub const O_CLOEXEC: ::c_int = 0x80000; |
James Perry | b979fe0 | 2016-01-23 21:28:42 +0000 | [diff] [blame] | 249 | |
Brian Campbell | cb12fdf | 2016-01-31 21:27:59 -0500 | [diff] [blame] | 250 | pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; |
James Perry | b979fe0 | 2016-01-23 21:28:42 +0000 | [diff] [blame] | 251 | |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 252 | pub const S_IFIFO: ::mode_t = 4096; |
| 253 | pub const S_IFCHR: ::mode_t = 8192; |
| 254 | pub const S_IFBLK: ::mode_t = 24576; |
| 255 | pub const S_IFDIR: ::mode_t = 16384; |
| 256 | pub const S_IFREG: ::mode_t = 32768; |
| 257 | pub const S_IFLNK: ::mode_t = 40960; |
| 258 | pub const S_IFSOCK: ::mode_t = 49152; |
| 259 | pub const S_IFMT: ::mode_t = 61440; |
| 260 | pub const S_IRWXU: ::mode_t = 448; |
| 261 | pub const S_IXUSR: ::mode_t = 64; |
| 262 | pub const S_IWUSR: ::mode_t = 128; |
| 263 | pub const S_IRUSR: ::mode_t = 256; |
| 264 | pub const S_IRWXG: ::mode_t = 56; |
| 265 | pub const S_IXGRP: ::mode_t = 8; |
| 266 | pub const S_IWGRP: ::mode_t = 16; |
| 267 | pub const S_IRGRP: ::mode_t = 32; |
| 268 | pub const S_IRWXO: ::mode_t = 7; |
| 269 | pub const S_IXOTH: ::mode_t = 1; |
| 270 | pub const S_IWOTH: ::mode_t = 2; |
| 271 | pub const S_IROTH: ::mode_t = 4; |
| 272 | pub const F_OK: ::c_int = 0; |
| 273 | pub const R_OK: ::c_int = 4; |
| 274 | pub const W_OK: ::c_int = 2; |
| 275 | pub const X_OK: ::c_int = 1; |
| 276 | pub const STDIN_FILENO: ::c_int = 0; |
| 277 | pub const STDOUT_FILENO: ::c_int = 1; |
| 278 | pub const STDERR_FILENO: ::c_int = 2; |
| 279 | pub const SIGHUP: ::c_int = 1; |
| 280 | pub const SIGINT: ::c_int = 2; |
| 281 | pub const SIGQUIT: ::c_int = 3; |
| 282 | pub const SIGILL: ::c_int = 4; |
| 283 | pub const SIGABRT: ::c_int = 6; |
| 284 | pub const SIGFPE: ::c_int = 8; |
| 285 | pub const SIGKILL: ::c_int = 9; |
| 286 | pub const SIGSEGV: ::c_int = 11; |
| 287 | pub const SIGPIPE: ::c_int = 13; |
| 288 | pub const SIGALRM: ::c_int = 14; |
| 289 | pub const SIGTERM: ::c_int = 15; |
| 290 | |
| 291 | pub const PROT_NONE: ::c_int = 0; |
| 292 | pub const PROT_READ: ::c_int = 1; |
| 293 | pub const PROT_WRITE: ::c_int = 2; |
| 294 | pub const PROT_EXEC: ::c_int = 4; |
| 295 | |
A.J. Gardner | 110152c | 2016-03-30 00:36:43 -0500 | [diff] [blame] | 296 | pub const LC_CTYPE: ::c_int = 0; |
| 297 | pub const LC_NUMERIC: ::c_int = 1; |
| 298 | pub const LC_TIME: ::c_int = 2; |
| 299 | pub const LC_COLLATE: ::c_int = 3; |
| 300 | pub const LC_MONETARY: ::c_int = 4; |
| 301 | pub const LC_MESSAGES: ::c_int = 5; |
| 302 | pub const LC_ALL: ::c_int = 6; |
A.J. Gardner | 24c84f1 | 2016-03-31 20:08:03 -0500 | [diff] [blame] | 303 | pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE); |
| 304 | pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC); |
| 305 | pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME); |
| 306 | pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE); |
| 307 | pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY); |
| 308 | pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES); |
| 309 | // LC_ALL_MASK defined per platform |
A.J. Gardner | 110152c | 2016-03-30 00:36:43 -0500 | [diff] [blame] | 310 | |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 311 | pub const MAP_FILE: ::c_int = 0x0000; |
| 312 | pub const MAP_SHARED: ::c_int = 0x0001; |
| 313 | pub const MAP_PRIVATE: ::c_int = 0x0002; |
| 314 | pub const MAP_FIXED: ::c_int = 0x0010; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 315 | |
| 316 | pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; |
| 317 | |
| 318 | pub const MCL_CURRENT: ::c_int = 0x0001; |
| 319 | pub const MCL_FUTURE: ::c_int = 0x0002; |
| 320 | |
Kamal Marhubi | 4ff4ace | 2016-03-14 17:00:38 -0400 | [diff] [blame] | 321 | // MS_ flags for msync(2) |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 322 | pub const MS_ASYNC: ::c_int = 0x0001; |
| 323 | pub const MS_INVALIDATE: ::c_int = 0x0002; |
| 324 | pub const MS_SYNC: ::c_int = 0x0004; |
Kamal Marhubi | 4ff4ace | 2016-03-14 17:00:38 -0400 | [diff] [blame] | 325 | |
| 326 | // MS_ flags for mount(2) |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 327 | pub const MS_RDONLY: ::c_ulong = 0x01; |
| 328 | pub const MS_NOSUID: ::c_ulong = 0x02; |
| 329 | pub const MS_NODEV: ::c_ulong = 0x04; |
| 330 | pub const MS_NOEXEC: ::c_ulong = 0x08; |
| 331 | pub const MS_SYNCHRONOUS: ::c_ulong = 0x10; |
| 332 | pub const MS_REMOUNT: ::c_ulong = 0x20; |
| 333 | pub const MS_MANDLOCK: ::c_ulong = 0x40; |
| 334 | pub const MS_DIRSYNC: ::c_ulong = 0x80; |
| 335 | pub const MS_NOATIME: ::c_ulong = 0x0400; |
| 336 | pub const MS_NODIRATIME: ::c_ulong = 0x0800; |
| 337 | pub const MS_BIND: ::c_ulong = 0x1000; |
| 338 | pub const MS_MOVE: ::c_ulong = 0x2000; |
| 339 | pub const MS_REC: ::c_ulong = 0x4000; |
| 340 | pub const MS_SILENT: ::c_ulong = 0x8000; |
| 341 | pub const MS_POSIXACL: ::c_ulong = 0x010000; |
| 342 | pub const MS_UNBINDABLE: ::c_ulong = 0x020000; |
| 343 | pub const MS_PRIVATE: ::c_ulong = 0x040000; |
| 344 | pub const MS_SLAVE: ::c_ulong = 0x080000; |
| 345 | pub const MS_SHARED: ::c_ulong = 0x100000; |
Kamal Marhubi | 10bfe07 | 2016-03-14 17:29:54 -0400 | [diff] [blame] | 346 | pub const MS_RELATIME: ::c_ulong = 0x200000; |
| 347 | pub const MS_KERNMOUNT: ::c_ulong = 0x400000; |
| 348 | pub const MS_I_VERSION: ::c_ulong = 0x800000; |
| 349 | pub const MS_STRICTATIME: ::c_ulong = 0x1000000; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 350 | pub const MS_ACTIVE: ::c_ulong = 0x40000000; |
| 351 | pub const MS_NOUSER: ::c_ulong = 0x80000000; |
| 352 | pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000; |
| 353 | pub const MS_MGC_MSK: ::c_ulong = 0xffff0000; |
Jim Blandy | e91606d | 2016-01-11 20:47:08 -0800 | [diff] [blame] | 354 | pub const MS_RMT_MASK: ::c_ulong = 0x800051; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 355 | |
| 356 | pub const EPERM: ::c_int = 1; |
| 357 | pub const ENOENT: ::c_int = 2; |
| 358 | pub const ESRCH: ::c_int = 3; |
| 359 | pub const EINTR: ::c_int = 4; |
| 360 | pub const EIO: ::c_int = 5; |
| 361 | pub const ENXIO: ::c_int = 6; |
| 362 | pub const E2BIG: ::c_int = 7; |
| 363 | pub const ENOEXEC: ::c_int = 8; |
| 364 | pub const EBADF: ::c_int = 9; |
| 365 | pub const ECHILD: ::c_int = 10; |
| 366 | pub const EAGAIN: ::c_int = 11; |
| 367 | pub const ENOMEM: ::c_int = 12; |
| 368 | pub const EACCES: ::c_int = 13; |
| 369 | pub const EFAULT: ::c_int = 14; |
| 370 | pub const ENOTBLK: ::c_int = 15; |
| 371 | pub const EBUSY: ::c_int = 16; |
| 372 | pub const EEXIST: ::c_int = 17; |
| 373 | pub const EXDEV: ::c_int = 18; |
| 374 | pub const ENODEV: ::c_int = 19; |
| 375 | pub const ENOTDIR: ::c_int = 20; |
| 376 | pub const EISDIR: ::c_int = 21; |
| 377 | pub const EINVAL: ::c_int = 22; |
| 378 | pub const ENFILE: ::c_int = 23; |
| 379 | pub const EMFILE: ::c_int = 24; |
| 380 | pub const ENOTTY: ::c_int = 25; |
| 381 | pub const ETXTBSY: ::c_int = 26; |
| 382 | pub const EFBIG: ::c_int = 27; |
| 383 | pub const ENOSPC: ::c_int = 28; |
| 384 | pub const ESPIPE: ::c_int = 29; |
| 385 | pub const EROFS: ::c_int = 30; |
| 386 | pub const EMLINK: ::c_int = 31; |
| 387 | pub const EPIPE: ::c_int = 32; |
| 388 | pub const EDOM: ::c_int = 33; |
| 389 | pub const ERANGE: ::c_int = 34; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 390 | pub const EWOULDBLOCK: ::c_int = EAGAIN; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 391 | |
| 392 | pub const EBFONT: ::c_int = 59; |
| 393 | pub const ENOSTR: ::c_int = 60; |
| 394 | pub const ENODATA: ::c_int = 61; |
| 395 | pub const ETIME: ::c_int = 62; |
| 396 | pub const ENOSR: ::c_int = 63; |
| 397 | pub const ENONET: ::c_int = 64; |
| 398 | pub const ENOPKG: ::c_int = 65; |
| 399 | pub const EREMOTE: ::c_int = 66; |
| 400 | pub const ENOLINK: ::c_int = 67; |
| 401 | pub const EADV: ::c_int = 68; |
| 402 | pub const ESRMNT: ::c_int = 69; |
| 403 | pub const ECOMM: ::c_int = 70; |
| 404 | pub const EPROTO: ::c_int = 71; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 405 | pub const EDOTDOT: ::c_int = 73; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 406 | |
| 407 | pub const AF_PACKET: ::c_int = 17; |
| 408 | pub const IPPROTO_RAW: ::c_int = 255; |
| 409 | |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 410 | pub const PROT_GROWSDOWN: ::c_int = 0x1000000; |
| 411 | pub const PROT_GROWSUP: ::c_int = 0x2000000; |
| 412 | |
| 413 | pub const MAP_TYPE: ::c_int = 0x000f; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 414 | |
| 415 | pub const MADV_NORMAL: ::c_int = 0; |
| 416 | pub const MADV_RANDOM: ::c_int = 1; |
| 417 | pub const MADV_SEQUENTIAL: ::c_int = 2; |
| 418 | pub const MADV_WILLNEED: ::c_int = 3; |
| 419 | pub const MADV_DONTNEED: ::c_int = 4; |
| 420 | pub const MADV_REMOVE: ::c_int = 9; |
| 421 | pub const MADV_DONTFORK: ::c_int = 10; |
| 422 | pub const MADV_DOFORK: ::c_int = 11; |
| 423 | pub const MADV_MERGEABLE: ::c_int = 12; |
| 424 | pub const MADV_UNMERGEABLE: ::c_int = 13; |
| 425 | pub const MADV_HWPOISON: ::c_int = 100; |
| 426 | |
| 427 | pub const IFF_LOOPBACK: ::c_int = 0x8; |
| 428 | |
| 429 | pub const AF_UNIX: ::c_int = 1; |
| 430 | pub const AF_INET: ::c_int = 2; |
| 431 | pub const AF_INET6: ::c_int = 10; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 432 | pub const SOCK_RAW: ::c_int = 3; |
| 433 | pub const IPPROTO_TCP: ::c_int = 6; |
| 434 | pub const IPPROTO_IP: ::c_int = 0; |
| 435 | pub const IPPROTO_IPV6: ::c_int = 41; |
| 436 | pub const IP_MULTICAST_TTL: ::c_int = 33; |
| 437 | pub const IP_MULTICAST_LOOP: ::c_int = 34; |
| 438 | pub const IP_TTL: ::c_int = 2; |
| 439 | pub const IP_HDRINCL: ::c_int = 3; |
| 440 | pub const IP_ADD_MEMBERSHIP: ::c_int = 35; |
| 441 | pub const IP_DROP_MEMBERSHIP: ::c_int = 36; |
Jakab Kristóf | d614a3f | 2016-01-19 18:07:14 +0100 | [diff] [blame] | 442 | pub const IP_TRANSPARENT: ::c_int = 19; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 443 | pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; |
| 444 | pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; |
| 445 | |
| 446 | pub const TCP_NODELAY: ::c_int = 1; |
| 447 | pub const TCP_MAXSEG: ::c_int = 2; |
| 448 | pub const TCP_CORK: ::c_int = 3; |
| 449 | pub const TCP_KEEPIDLE: ::c_int = 4; |
| 450 | pub const TCP_KEEPINTVL: ::c_int = 5; |
| 451 | pub const TCP_KEEPCNT: ::c_int = 6; |
| 452 | pub const TCP_SYNCNT: ::c_int = 7; |
| 453 | pub const TCP_LINGER2: ::c_int = 8; |
| 454 | pub const TCP_DEFER_ACCEPT: ::c_int = 9; |
| 455 | pub const TCP_WINDOW_CLAMP: ::c_int = 10; |
| 456 | pub const TCP_INFO: ::c_int = 11; |
| 457 | pub const TCP_QUICKACK: ::c_int = 12; |
| 458 | pub const TCP_CONGESTION: ::c_int = 13; |
| 459 | |
Alex Crichton | babf390 | 2015-09-18 17:16:51 -0700 | [diff] [blame] | 460 | pub const IPV6_MULTICAST_LOOP: ::c_int = 19; |
| 461 | pub const IPV6_V6ONLY: ::c_int = 26; |
| 462 | |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 463 | pub const SO_DEBUG: ::c_int = 1; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 464 | |
| 465 | pub const SHUT_RD: ::c_int = 0; |
| 466 | pub const SHUT_WR: ::c_int = 1; |
| 467 | pub const SHUT_RDWR: ::c_int = 2; |
| 468 | |
| 469 | pub const LOCK_SH: ::c_int = 1; |
| 470 | pub const LOCK_EX: ::c_int = 2; |
| 471 | pub const LOCK_NB: ::c_int = 4; |
| 472 | pub const LOCK_UN: ::c_int = 8; |
| 473 | |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 474 | pub const SIGSTKSZ: ::size_t = 8192; |
| 475 | |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 476 | pub const SA_NODEFER: ::c_int = 0x40000000; |
| 477 | pub const SA_RESETHAND: ::c_int = 0x80000000; |
| 478 | pub const SA_RESTART: ::c_int = 0x10000000; |
| 479 | pub const SA_NOCLDSTOP: ::c_int = 0x00000001; |
| 480 | |
Tomasz MiÄ…sko | 26e1ec1 | 2016-02-15 11:44:55 +0100 | [diff] [blame] | 481 | pub const SS_ONSTACK: ::c_int = 1; |
| 482 | pub const SS_DISABLE: ::c_int = 2; |
| 483 | |
David Hotham | 8b296bd | 2015-12-12 11:52:54 +0000 | [diff] [blame] | 484 | pub const PATH_MAX: ::c_int = 4096; |
| 485 | |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 486 | pub const FD_SETSIZE: usize = 1024; |
| 487 | |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 488 | pub const EPOLLIN: ::c_int = 0x1; |
| 489 | pub const EPOLLPRI: ::c_int = 0x2; |
| 490 | pub const EPOLLOUT: ::c_int = 0x4; |
| 491 | pub const EPOLLRDNORM: ::c_int = 0x40; |
| 492 | pub const EPOLLRDBAND: ::c_int = 0x80; |
| 493 | pub const EPOLLWRNORM: ::c_int = 0x100; |
| 494 | pub const EPOLLWRBAND: ::c_int = 0x200; |
| 495 | pub const EPOLLMSG: ::c_int = 0x400; |
| 496 | pub const EPOLLERR: ::c_int = 0x8; |
| 497 | pub const EPOLLHUP: ::c_int = 0x10; |
| 498 | pub const EPOLLET: ::c_int = 0x80000000; |
| 499 | |
| 500 | pub const EPOLL_CTL_ADD: ::c_int = 1; |
| 501 | pub const EPOLL_CTL_MOD: ::c_int = 3; |
| 502 | pub const EPOLL_CTL_DEL: ::c_int = 2; |
| 503 | |
| 504 | pub const MNT_DETACH: ::c_int = 0x2; |
| 505 | pub const MNT_EXPIRE: ::c_int = 0x4; |
| 506 | |
| 507 | pub const Q_GETFMT: ::c_int = 0x800004; |
| 508 | pub const Q_GETINFO: ::c_int = 0x800005; |
| 509 | pub const Q_SETINFO: ::c_int = 0x800006; |
| 510 | pub const QIF_BLIMITS: ::uint32_t = 1; |
| 511 | pub const QIF_SPACE: ::uint32_t = 2; |
| 512 | pub const QIF_ILIMITS: ::uint32_t = 4; |
| 513 | pub const QIF_INODES: ::uint32_t = 8; |
| 514 | pub const QIF_BTIME: ::uint32_t = 16; |
| 515 | pub const QIF_ITIME: ::uint32_t = 32; |
| 516 | pub const QIF_LIMITS: ::uint32_t = 5; |
| 517 | pub const QIF_USAGE: ::uint32_t = 10; |
| 518 | pub const QIF_TIMES: ::uint32_t = 48; |
| 519 | pub const QIF_ALL: ::uint32_t = 63; |
| 520 | |
| 521 | pub const CBAUD: ::tcflag_t = 0o0010017; |
| 522 | |
| 523 | pub const EFD_CLOEXEC: ::c_int = 0x80000; |
| 524 | |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 525 | pub const MNT_FORCE: ::c_int = 0x1; |
| 526 | |
| 527 | pub const Q_SYNC: ::c_int = 0x800001; |
| 528 | pub const Q_QUOTAON: ::c_int = 0x800002; |
| 529 | pub const Q_QUOTAOFF: ::c_int = 0x800003; |
| 530 | pub const Q_GETQUOTA: ::c_int = 0x800007; |
| 531 | pub const Q_SETQUOTA: ::c_int = 0x800008; |
| 532 | |
| 533 | pub const TCIOFF: ::c_int = 2; |
| 534 | pub const TCION: ::c_int = 3; |
| 535 | pub const TCOOFF: ::c_int = 0; |
| 536 | pub const TCOON: ::c_int = 1; |
| 537 | pub const TCIFLUSH: ::c_int = 0; |
| 538 | pub const TCOFLUSH: ::c_int = 1; |
| 539 | pub const TCIOFLUSH: ::c_int = 2; |
| 540 | pub const NL0: ::c_int = 0x00000000; |
| 541 | pub const NL1: ::c_int = 0x00000100; |
| 542 | pub const TAB0: ::c_int = 0x00000000; |
| 543 | pub const TAB1: ::c_int = 0x00000800; |
| 544 | pub const TAB2: ::c_int = 0x00001000; |
| 545 | pub const TAB3: ::c_int = 0x00001800; |
| 546 | pub const CR0: ::c_int = 0x00000000; |
| 547 | pub const CR1: ::c_int = 0x00000200; |
| 548 | pub const CR2: ::c_int = 0x00000400; |
| 549 | pub const CR3: ::c_int = 0x00000600; |
| 550 | pub const FF0: ::c_int = 0x00000000; |
| 551 | pub const FF1: ::c_int = 0x00008000; |
| 552 | pub const BS0: ::c_int = 0x00000000; |
| 553 | pub const BS1: ::c_int = 0x00002000; |
| 554 | pub const VT0: ::c_int = 0x00000000; |
| 555 | pub const VT1: ::c_int = 0x00004000; |
| 556 | pub const VERASE: usize = 2; |
| 557 | pub const VWERASE: usize = 14; |
| 558 | pub const VKILL: usize = 3; |
| 559 | pub const VREPRINT: usize = 12; |
| 560 | pub const VINTR: usize = 0; |
| 561 | pub const VQUIT: usize = 1; |
| 562 | pub const VSUSP: usize = 10; |
| 563 | pub const VSTART: usize = 8; |
| 564 | pub const VSTOP: usize = 9; |
| 565 | pub const VLNEXT: usize = 15; |
| 566 | pub const VDISCARD: usize = 13; |
| 567 | pub const VTIME: usize = 5; |
| 568 | pub const IGNBRK: ::tcflag_t = 0x00000001; |
| 569 | pub const BRKINT: ::tcflag_t = 0x00000002; |
| 570 | pub const IGNPAR: ::tcflag_t = 0x00000004; |
| 571 | pub const PARMRK: ::tcflag_t = 0x00000008; |
| 572 | pub const INPCK: ::tcflag_t = 0x00000010; |
| 573 | pub const ISTRIP: ::tcflag_t = 0x00000020; |
| 574 | pub const INLCR: ::tcflag_t = 0x00000040; |
| 575 | pub const IGNCR: ::tcflag_t = 0x00000080; |
| 576 | pub const ICRNL: ::tcflag_t = 0x00000100; |
| 577 | pub const IXON: ::tcflag_t = 0x00000400; |
| 578 | pub const IXOFF: ::tcflag_t = 0x00001000; |
| 579 | pub const IXANY: ::tcflag_t = 0x00000800; |
| 580 | pub const IMAXBEL: ::tcflag_t = 0x00002000; |
| 581 | pub const OPOST: ::tcflag_t = 0x1; |
| 582 | pub const ONLCR: ::tcflag_t = 0x4; |
| 583 | pub const CSIZE: ::tcflag_t = 0x00000030; |
| 584 | pub const CS5: ::tcflag_t = 0x00000000; |
| 585 | pub const CS6: ::tcflag_t = 0x00000010; |
| 586 | pub const CS7: ::tcflag_t = 0x00000020; |
| 587 | pub const CS8: ::tcflag_t = 0x00000030; |
| 588 | pub const CSTOPB: ::tcflag_t = 0x00000040; |
| 589 | pub const CREAD: ::tcflag_t = 0x00000080; |
| 590 | pub const PARENB: ::tcflag_t = 0x00000100; |
| 591 | pub const PARODD: ::tcflag_t = 0x00000200; |
| 592 | pub const HUPCL: ::tcflag_t = 0x00000400; |
| 593 | pub const CLOCAL: ::tcflag_t = 0x00000800; |
| 594 | pub const CRTSCTS: ::tcflag_t = 0x80000000; |
| 595 | pub const ECHOKE: ::tcflag_t = 0x00000800; |
| 596 | pub const ECHOE: ::tcflag_t = 0x00000010; |
| 597 | pub const ECHOK: ::tcflag_t = 0x00000020; |
| 598 | pub const ECHO: ::tcflag_t = 0x00000008; |
| 599 | pub const ECHONL: ::tcflag_t = 0x00000040; |
| 600 | pub const ECHOPRT: ::tcflag_t = 0x00000400; |
| 601 | pub const ECHOCTL: ::tcflag_t = 0x00000200; |
| 602 | pub const ISIG: ::tcflag_t = 0x00000001; |
| 603 | pub const ICANON: ::tcflag_t = 0x00000002; |
| 604 | pub const PENDIN: ::tcflag_t = 0x00004000; |
| 605 | pub const NOFLSH: ::tcflag_t = 0x00000080; |
| 606 | |
| 607 | pub const CLONE_VM: ::c_int = 0x100; |
| 608 | pub const CLONE_FS: ::c_int = 0x200; |
| 609 | pub const CLONE_FILES: ::c_int = 0x400; |
| 610 | pub const CLONE_SIGHAND: ::c_int = 0x800; |
| 611 | pub const CLONE_PTRACE: ::c_int = 0x2000; |
| 612 | pub const CLONE_VFORK: ::c_int = 0x4000; |
| 613 | pub const CLONE_PARENT: ::c_int = 0x8000; |
| 614 | pub const CLONE_THREAD: ::c_int = 0x10000; |
| 615 | pub const CLONE_NEWNS: ::c_int = 0x20000; |
| 616 | pub const CLONE_SYSVSEM: ::c_int = 0x40000; |
| 617 | pub const CLONE_SETTLS: ::c_int = 0x80000; |
| 618 | pub const CLONE_PARENT_SETTID: ::c_int = 0x100000; |
| 619 | pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000; |
| 620 | pub const CLONE_DETACHED: ::c_int = 0x400000; |
| 621 | pub const CLONE_UNTRACED: ::c_int = 0x800000; |
| 622 | pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000; |
Kamal Marhubi | ae69a16 | 2016-03-13 16:05:36 -0400 | [diff] [blame] | 623 | pub const CLONE_NEWUTS: ::c_int = 0x04000000; |
| 624 | pub const CLONE_NEWIPC: ::c_int = 0x08000000; |
| 625 | pub const CLONE_NEWUSER: ::c_int = 0x10000000; |
| 626 | pub const CLONE_NEWPID: ::c_int = 0x20000000; |
| 627 | pub const CLONE_NEWNET: ::c_int = 0x40000000; |
| 628 | pub const CLONE_IO: ::c_int = 0x80000000; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 629 | |
Nikita Baksalyar | 25726a6 | 2016-01-17 21:41:34 +0300 | [diff] [blame] | 630 | pub const WNOHANG: ::c_int = 1; |
| 631 | |
Kamal Marhubi | 0cfc25f | 2016-02-04 15:57:10 -0500 | [diff] [blame] | 632 | pub const SPLICE_F_MOVE: ::c_uint = 0x01; |
| 633 | pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02; |
| 634 | pub const SPLICE_F_MORE: ::c_uint = 0x04; |
| 635 | pub const SPLICE_F_GIFT: ::c_uint = 0x08; |
| 636 | |
Alex Crichton | 29de598 | 2016-02-04 13:48:13 -0800 | [diff] [blame] | 637 | pub const RTLD_LOCAL: ::c_int = 0; |
| 638 | |
Austin Bonander | 10543d0 | 2016-02-06 18:58:18 -0800 | [diff] [blame] | 639 | pub const POSIX_FADV_NORMAL: ::c_int = 0; |
| 640 | pub const POSIX_FADV_RANDOM: ::c_int = 1; |
| 641 | pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2; |
| 642 | pub const POSIX_FADV_WILLNEED: ::c_int = 3; |
| 643 | pub const POSIX_FADV_DONTNEED: ::c_int = 4; |
| 644 | pub const POSIX_FADV_NOREUSE: ::c_int = 5; |
| 645 | |
fpgaminer | f5885ee | 2016-03-06 19:49:06 -0800 | [diff] [blame] | 646 | pub const AT_FDCWD: ::c_int = -100; |
| 647 | pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; |
| 648 | |
Raphael Cohn | 7fc0969 | 2016-05-05 15:41:21 +0100 | [diff] [blame] | 649 | pub const LOG_CRON: ::c_int = 9 << 3; |
| 650 | pub const LOG_AUTHPRIV: ::c_int = 10 << 3; |
| 651 | pub const LOG_FTP: ::c_int = 11 << 3; |
Raphael Cohn | 7fc0969 | 2016-05-05 15:41:21 +0100 | [diff] [blame] | 652 | pub const LOG_PERROR: ::c_int = 0x20; |
| 653 | |
Kamal Marhubi | ce0dc73 | 2016-05-05 16:46:50 -0400 | [diff] [blame] | 654 | pub const PIPE_BUF: usize = 4096; |
| 655 | |
Raphael Cohn | e6150ae | 2016-05-13 11:18:34 +0100 | [diff] [blame] | 656 | pub const SI_LOAD_SHIFT: ::c_uint = 16; |
| 657 | |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 658 | f! { |
| 659 | pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { |
| 660 | let fd = fd as usize; |
Alex Crichton | ef66d12 | 2015-11-09 23:53:57 -0800 | [diff] [blame] | 661 | let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 662 | (*set).fds_bits[fd / size] &= !(1 << (fd % size)); |
| 663 | return |
| 664 | } |
| 665 | |
| 666 | pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { |
| 667 | let fd = fd as usize; |
Alex Crichton | ef66d12 | 2015-11-09 23:53:57 -0800 | [diff] [blame] | 668 | let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 669 | return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 |
| 670 | } |
| 671 | |
| 672 | pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { |
| 673 | let fd = fd as usize; |
Alex Crichton | ef66d12 | 2015-11-09 23:53:57 -0800 | [diff] [blame] | 674 | let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 675 | (*set).fds_bits[fd / size] |= 1 << (fd % size); |
| 676 | return |
| 677 | } |
| 678 | |
| 679 | pub fn FD_ZERO(set: *mut fd_set) -> () { |
| 680 | for slot in (*set).fds_bits.iter_mut() { |
| 681 | *slot = 0; |
| 682 | } |
| 683 | } |
| 684 | |
| 685 | pub fn WIFEXITED(status: ::c_int) -> bool { |
| 686 | (status & 0xff) == 0 |
| 687 | } |
| 688 | |
| 689 | pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { |
| 690 | (status >> 8) & 0xff |
| 691 | } |
| 692 | |
| 693 | pub fn WTERMSIG(status: ::c_int) -> ::c_int { |
| 694 | status & 0x7f |
| 695 | } |
| 696 | } |
| 697 | |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 698 | extern { |
Nikita Baksalyar | bff3892 | 2016-01-17 22:17:20 +0300 | [diff] [blame] | 699 | pub fn getpwuid_r(uid: ::uid_t, |
| 700 | pwd: *mut passwd, |
| 701 | buf: *mut ::c_char, |
| 702 | buflen: ::size_t, |
| 703 | result: *mut *mut passwd) -> ::c_int; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 704 | pub fn fdatasync(fd: ::c_int) -> ::c_int; |
Alex Crichton | 8293ced | 2015-09-15 17:05:19 -0700 | [diff] [blame] | 705 | pub fn mincore(addr: *mut ::c_void, len: ::size_t, |
| 706 | vec: *mut ::c_uchar) -> ::c_int; |
NODA, Kai | 7e752a3 | 2016-03-31 18:59:05 +0800 | [diff] [blame] | 707 | pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; |
| 708 | pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 709 | pub fn prctl(option: ::c_int, ...) -> ::c_int; |
| 710 | pub fn pthread_getattr_np(native: ::pthread_t, |
| 711 | attr: *mut ::pthread_attr_t) -> ::c_int; |
| 712 | pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t, |
| 713 | guardsize: *mut ::size_t) -> ::c_int; |
| 714 | pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t, |
| 715 | stackaddr: *mut *mut ::c_void, |
| 716 | stacksize: *mut ::size_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 717 | pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; |
| 718 | pub fn setgroups(ngroups: ::size_t, |
| 719 | ptr: *const ::gid_t) -> ::c_int; |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 720 | pub fn sched_setscheduler(pid: ::pid_t, |
| 721 | policy: ::c_int, |
| 722 | param: *const sched_param) -> ::c_int; |
Alexander Polakov | e09951c | 2015-11-26 14:00:03 +0300 | [diff] [blame] | 723 | pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; |
Alexander Polakov | 557c670 | 2015-11-30 16:55:51 +0300 | [diff] [blame] | 724 | pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int; |
| 725 | pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 726 | pub fn epoll_create(size: ::c_int) -> ::c_int; |
| 727 | pub fn epoll_ctl(epfd: ::c_int, |
| 728 | op: ::c_int, |
| 729 | fd: ::c_int, |
| 730 | event: *mut epoll_event) -> ::c_int; |
| 731 | pub fn epoll_wait(epfd: ::c_int, |
| 732 | events: *mut epoll_event, |
| 733 | maxevents: ::c_int, |
| 734 | timeout: ::c_int) -> ::c_int; |
| 735 | pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; |
| 736 | pub fn mount(src: *const ::c_char, |
| 737 | target: *const ::c_char, |
| 738 | fstype: *const ::c_char, |
| 739 | flags: ::c_ulong, |
| 740 | data: *const ::c_void) -> ::c_int; |
| 741 | pub fn umount(target: *const ::c_char) -> ::c_int; |
| 742 | pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int; |
| 743 | pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int, |
| 744 | child_stack: *mut ::c_void, |
| 745 | flags: ::c_int, |
| 746 | arg: *mut ::c_void, ...) -> ::c_int; |
| 747 | pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; |
| 748 | pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 749 | pub fn memrchr(cx: *const ::c_void, |
| 750 | c: ::c_int, |
| 751 | n: ::size_t) -> *mut ::c_void; |
Alex Crichton | 881ef9b | 2015-12-01 09:04:13 -0800 | [diff] [blame] | 752 | pub fn syscall(num: ::c_long, ...) -> ::c_long; |
Kamal Marhubi | 143358b | 2016-02-04 14:08:50 -0500 | [diff] [blame] | 753 | pub fn sendfile(out_fd: ::c_int, |
| 754 | in_fd: ::c_int, |
| 755 | offset: *mut off_t, |
| 756 | count: ::size_t) -> ::ssize_t; |
Kamal Marhubi | 0cfc25f | 2016-02-04 15:57:10 -0500 | [diff] [blame] | 757 | pub fn splice(fd_in: ::c_int, |
| 758 | off_in: *mut ::loff_t, |
| 759 | fd_out: ::c_int, |
| 760 | off_out: *mut ::loff_t, |
| 761 | len: ::size_t, |
| 762 | flags: ::c_uint) -> ::ssize_t; |
| 763 | pub fn tee(fd_in: ::c_int, |
| 764 | fd_out: ::c_int, |
| 765 | len: ::size_t, |
| 766 | flags: ::c_uint) -> ::ssize_t; |
| 767 | pub fn vmsplice(fd: ::c_int, |
| 768 | iov: *const ::iovec, |
| 769 | nr_segs: ::size_t, |
| 770 | flags: ::c_uint) -> ::ssize_t; |
Austin Bonander | 10543d0 | 2016-02-06 18:58:18 -0800 | [diff] [blame] | 771 | |
Paul Dicker | 9853b46 | 2016-02-29 21:10:29 +0100 | [diff] [blame] | 772 | pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, |
Austin Bonander | 10543d0 | 2016-02-06 18:58:18 -0800 | [diff] [blame] | 773 | advise: ::c_int) -> ::c_int; |
Paul Dicker | 9853b46 | 2016-02-29 21:10:29 +0100 | [diff] [blame] | 774 | pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; |
fpgaminer | f5885ee | 2016-03-06 19:49:06 -0800 | [diff] [blame] | 775 | pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, |
| 776 | times: *const ::timespec, flag: ::c_int) -> ::c_int; |
A.J. Gardner | 24c84f1 | 2016-03-31 20:08:03 -0500 | [diff] [blame] | 777 | pub fn duplocale(base: ::locale_t) -> ::locale_t; |
| 778 | pub fn freelocale(loc: ::locale_t); |
| 779 | pub fn newlocale(mask: ::c_int, |
| 780 | locale: *const ::c_char, |
| 781 | base: ::locale_t) -> ::locale_t; |
| 782 | pub fn uselocale(loc: ::locale_t) -> ::locale_t; |
Kamal Marhubi | b9750b6 | 2016-04-27 14:04:31 -0400 | [diff] [blame] | 783 | pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int; |
| 784 | pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int; |
| 785 | pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int; |
| 786 | pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int; |
| 787 | pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t; |
| 788 | pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int; |
| 789 | pub fn mmap64(addr: *mut ::c_void, |
| 790 | len: ::size_t, |
| 791 | prot: ::c_int, |
| 792 | flags: ::c_int, |
| 793 | fd: ::c_int, |
| 794 | offset: off64_t) |
| 795 | -> *mut ::c_void; |
| 796 | pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; |
| 797 | pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, |
| 798 | offset: off64_t) -> ::ssize_t; |
| 799 | pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t, |
| 800 | offset: off64_t) -> ::ssize_t; |
| 801 | pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64, |
| 802 | result: *mut *mut ::dirent64) -> ::c_int; |
| 803 | pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int; |
| 804 | pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int; |
| 805 | pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; |
Raphael Cohn | e6150ae | 2016-05-13 11:18:34 +0100 | [diff] [blame] | 806 | pub fn sysinfo (info: *mut ::sysinfo) -> ::c_int; |
Axel Viala | 26ee782 | 2016-06-10 02:33:32 +0200 | [diff] [blame^] | 807 | |
| 808 | pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, |
| 809 | flags: ::c_int, ...) -> ::c_int; |
| 810 | pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, |
| 811 | mode: ::c_int, flags: ::c_int) -> ::c_int; |
| 812 | pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char, |
| 813 | mode: ::mode_t, flags: ::c_int) -> ::c_int; |
| 814 | pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char, |
| 815 | owner: ::uid_t, group: ::gid_t, |
| 816 | flags: ::c_int) -> ::c_int; |
| 817 | pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char, |
| 818 | buf: *mut stat, flags: ::c_int) -> ::c_int; |
| 819 | pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char, |
| 820 | newdirfd: ::c_int, newpath: *const ::c_char, |
| 821 | flags: ::c_int) -> ::c_int; |
| 822 | pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, |
| 823 | mode: ::mode_t) -> ::c_int; |
| 824 | pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, |
| 825 | mode: ::mode_t, dev: dev_t) -> ::c_int; |
| 826 | pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char, |
| 827 | buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t; |
| 828 | pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char, |
| 829 | newdirfd: ::c_int, newpath: *const ::c_char) |
| 830 | -> ::c_int; |
| 831 | pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int, |
| 832 | linkpath: *const ::c_char) -> ::c_int; |
| 833 | pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, |
| 834 | flags: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 835 | } |
| 836 | |
| 837 | cfg_if! { |
Brian Anderson | 7d1d575 | 2015-11-26 23:27:45 +0000 | [diff] [blame] | 838 | if #[cfg(any(target_os = "linux", |
| 839 | target_os = "emscripten"))] { |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 840 | mod linux; |
| 841 | pub use self::linux::*; |
| 842 | } else if #[cfg(target_os = "android")] { |
| 843 | mod android; |
| 844 | pub use self::android::*; |
| 845 | } else { |
Kamal Marhubi | 66c3375 | 2016-03-10 15:07:32 -0500 | [diff] [blame] | 846 | // Unknown target_os |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 847 | } |
| 848 | } |