Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 1 | //! Linux-specific definitions for linux-like values |
| 2 | |
Marco A L Barbosa | a3759d7 | 2017-02-27 17:25:55 -0300 | [diff] [blame] | 3 | use dox::{mem, Option}; |
Peter Jin | 1a190c7 | 2016-02-05 15:06:39 -0800 | [diff] [blame] | 4 | |
Alex Crichton | 918f8e1 | 2015-09-15 16:39:51 -0700 | [diff] [blame] | 5 | pub type useconds_t = u32; |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 6 | pub type dev_t = u64; |
| 7 | pub type socklen_t = u32; |
| 8 | pub type pthread_t = c_ulong; |
Alex Crichton | c4a8d60 | 2015-09-18 15:00:49 -0700 | [diff] [blame] | 9 | pub type mode_t = u32; |
Alex Crichton | 7482522 | 2015-10-29 17:36:55 -0700 | [diff] [blame] | 10 | pub type ino64_t = u64; |
| 11 | pub type off64_t = i64; |
| 12 | pub type blkcnt64_t = i64; |
| 13 | pub type rlim64_t = u64; |
Alexander Polakov | 5850156 | 2015-12-14 02:09:45 +0300 | [diff] [blame] | 14 | pub type shmatt_t = ::c_ulong; |
Alex Crichton | 881ef9b | 2015-12-01 09:04:13 -0800 | [diff] [blame] | 15 | pub type mqd_t = ::c_int; |
Alexander Schlarb | 7590565 | 2016-09-17 22:17:17 +0200 | [diff] [blame] | 16 | pub type msgqnum_t = ::c_ulong; |
| 17 | pub type msglen_t = ::c_ulong; |
David Henningsson | 9d2493e | 2015-12-25 22:06:44 +0100 | [diff] [blame] | 18 | pub type nfds_t = ::c_ulong; |
A.J. Gardner | 24c84f1 | 2016-03-31 20:08:03 -0500 | [diff] [blame] | 19 | pub type nl_item = ::c_int; |
Zack Weinberg | 984fb54 | 2017-01-10 11:09:51 -0500 | [diff] [blame] | 20 | pub type idtype_t = ::c_uint; |
Alex Crichton | 7482522 | 2015-10-29 17:36:55 -0700 | [diff] [blame] | 21 | |
| 22 | pub enum fpos64_t {} // TODO: fill this out with a struct |
Alex Crichton | 918f8e1 | 2015-09-15 16:39:51 -0700 | [diff] [blame] | 23 | |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 24 | s! { |
Alex Crichton | d6e07e2 | 2015-10-29 22:59:44 -0700 | [diff] [blame] | 25 | pub struct dirent { |
| 26 | pub d_ino: ::ino_t, |
| 27 | pub d_off: ::off_t, |
| 28 | pub d_reclen: ::c_ushort, |
| 29 | pub d_type: ::c_uchar, |
| 30 | pub d_name: [::c_char; 256], |
| 31 | } |
| 32 | |
Alex Crichton | 7482522 | 2015-10-29 17:36:55 -0700 | [diff] [blame] | 33 | pub struct dirent64 { |
| 34 | pub d_ino: ::ino64_t, |
| 35 | pub d_off: ::off64_t, |
| 36 | pub d_reclen: ::c_ushort, |
| 37 | pub d_type: ::c_uchar, |
| 38 | pub d_name: [::c_char; 256], |
| 39 | } |
| 40 | |
| 41 | pub struct rlimit64 { |
| 42 | pub rlim_cur: rlim64_t, |
| 43 | pub rlim_max: rlim64_t, |
| 44 | } |
| 45 | |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 46 | pub struct glob_t { |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 47 | pub gl_pathc: ::size_t, |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 48 | pub gl_pathv: *mut *mut c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 49 | pub gl_offs: ::size_t, |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 50 | pub gl_flags: ::c_int, |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 51 | |
| 52 | __unused1: *mut ::c_void, |
| 53 | __unused2: *mut ::c_void, |
| 54 | __unused3: *mut ::c_void, |
| 55 | __unused4: *mut ::c_void, |
| 56 | __unused5: *mut ::c_void, |
| 57 | } |
| 58 | |
| 59 | pub struct ifaddrs { |
| 60 | pub ifa_next: *mut ifaddrs, |
| 61 | pub ifa_name: *mut c_char, |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 62 | pub ifa_flags: ::c_uint, |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 63 | pub ifa_addr: *mut ::sockaddr, |
| 64 | pub ifa_netmask: *mut ::sockaddr, |
| 65 | pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union |
| 66 | pub ifa_data: *mut ::c_void |
| 67 | } |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 68 | |
| 69 | pub struct pthread_mutex_t { |
Wang Xuerui | 0caba71 | 2016-11-07 11:18:05 +0800 | [diff] [blame] | 70 | #[cfg(any(target_arch = "mips", target_arch = "arm", |
| 71 | target_arch = "powerpc"))] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 72 | __align: [::c_long; 0], |
Wang Xuerui | 0caba71 | 2016-11-07 11:18:05 +0800 | [diff] [blame] | 73 | #[cfg(not(any(target_arch = "mips", target_arch = "arm", |
| 74 | target_arch = "powerpc")))] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 75 | __align: [::c_longlong; 0], |
| 76 | size: [u8; __SIZEOF_PTHREAD_MUTEX_T], |
| 77 | } |
| 78 | |
| 79 | pub struct pthread_rwlock_t { |
Wang Xuerui | 0caba71 | 2016-11-07 11:18:05 +0800 | [diff] [blame] | 80 | #[cfg(any(target_arch = "mips", target_arch = "arm", |
| 81 | target_arch = "powerpc"))] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 82 | __align: [::c_long; 0], |
Wang Xuerui | 0caba71 | 2016-11-07 11:18:05 +0800 | [diff] [blame] | 83 | #[cfg(not(any(target_arch = "mips", target_arch = "arm", |
| 84 | target_arch = "powerpc")))] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 85 | __align: [::c_longlong; 0], |
| 86 | size: [u8; __SIZEOF_PTHREAD_RWLOCK_T], |
| 87 | } |
| 88 | |
| 89 | pub struct pthread_mutexattr_t { |
Jorge Aparicio | 196b0e8 | 2016-08-26 22:30:42 -0500 | [diff] [blame] | 90 | #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64", |
Jorge Aparicio | 9858987 | 2016-12-30 01:33:51 -0500 | [diff] [blame] | 91 | target_arch = "mips64", target_arch = "s390x", |
| 92 | target_arch = "sparc64"))] |
Alex Crichton | b347b44 | 2015-09-17 15:48:30 -0700 | [diff] [blame] | 93 | __align: [::c_int; 0], |
Jorge Aparicio | 196b0e8 | 2016-08-26 22:30:42 -0500 | [diff] [blame] | 94 | #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64", |
Jorge Aparicio | 9858987 | 2016-12-30 01:33:51 -0500 | [diff] [blame] | 95 | target_arch = "mips64", target_arch = "s390x", |
| 96 | target_arch = "sparc64")))] |
Alex Crichton | 684cfa4 | 2015-09-17 15:18:18 -0700 | [diff] [blame] | 97 | __align: [::c_long; 0], |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 98 | size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T], |
| 99 | } |
| 100 | |
| 101 | pub struct pthread_cond_t { |
Jorge Aparicio | 23a5092 | 2016-07-26 16:13:03 -0500 | [diff] [blame] | 102 | #[cfg(any(target_env = "musl"))] |
Jorge Aparicio | 751bea3 | 2016-01-30 01:28:50 -0500 | [diff] [blame] | 103 | __align: [*const ::c_void; 0], |
Jorge Aparicio | 23a5092 | 2016-07-26 16:13:03 -0500 | [diff] [blame] | 104 | #[cfg(not(any(target_env = "musl")))] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 105 | __align: [::c_longlong; 0], |
| 106 | size: [u8; __SIZEOF_PTHREAD_COND_T], |
| 107 | } |
| 108 | |
Tomasz MiÄ…sko | cb64485 | 2016-07-20 07:31:48 +0200 | [diff] [blame] | 109 | pub struct pthread_condattr_t { |
| 110 | __align: [::c_int; 0], |
| 111 | size: [u8; __SIZEOF_PTHREAD_CONDATTR_T], |
| 112 | } |
| 113 | |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 114 | pub struct passwd { |
| 115 | pub pw_name: *mut ::c_char, |
| 116 | pub pw_passwd: *mut ::c_char, |
| 117 | pub pw_uid: ::uid_t, |
| 118 | pub pw_gid: ::gid_t, |
| 119 | pub pw_gecos: *mut ::c_char, |
| 120 | pub pw_dir: *mut ::c_char, |
| 121 | pub pw_shell: *mut ::c_char, |
| 122 | } |
Dan Burkert | 85a76f8 | 2015-11-04 20:26:27 -0800 | [diff] [blame] | 123 | |
Philipp Keller | 26f3eb9 | 2016-09-26 22:00:29 +0200 | [diff] [blame] | 124 | pub struct spwd { |
| 125 | pub sp_namp: *mut ::c_char, |
| 126 | pub sp_pwdp: *mut ::c_char, |
| 127 | pub sp_lstchg: ::c_long, |
| 128 | pub sp_min: ::c_long, |
| 129 | pub sp_max: ::c_long, |
| 130 | pub sp_warn: ::c_long, |
| 131 | pub sp_inact: ::c_long, |
| 132 | pub sp_expire: ::c_long, |
| 133 | pub sp_flag: ::c_ulong, |
| 134 | } |
| 135 | |
Dan Burkert | 85a76f8 | 2015-11-04 20:26:27 -0800 | [diff] [blame] | 136 | pub struct statvfs { |
| 137 | pub f_bsize: ::c_ulong, |
| 138 | pub f_frsize: ::c_ulong, |
| 139 | pub f_blocks: ::fsblkcnt_t, |
| 140 | pub f_bfree: ::fsblkcnt_t, |
| 141 | pub f_bavail: ::fsblkcnt_t, |
| 142 | pub f_files: ::fsfilcnt_t, |
| 143 | pub f_ffree: ::fsfilcnt_t, |
| 144 | pub f_favail: ::fsfilcnt_t, |
Jorge Aparicio | 3df0057 | 2016-09-11 23:57:37 -0500 | [diff] [blame] | 145 | #[cfg(target_endian = "little")] |
Dan Burkert | 85a76f8 | 2015-11-04 20:26:27 -0800 | [diff] [blame] | 146 | pub f_fsid: ::c_ulong, |
| 147 | #[cfg(target_pointer_width = "32")] |
Jorge Aparicio | 41101f2 | 2016-09-12 23:41:17 -0500 | [diff] [blame] | 148 | __f_unused: ::c_int, |
Jorge Aparicio | 3df0057 | 2016-09-11 23:57:37 -0500 | [diff] [blame] | 149 | #[cfg(target_endian = "big")] |
| 150 | pub f_fsid: ::c_ulong, |
Dan Burkert | 85a76f8 | 2015-11-04 20:26:27 -0800 | [diff] [blame] | 151 | pub f_flag: ::c_ulong, |
| 152 | pub f_namemax: ::c_ulong, |
| 153 | __f_spare: [::c_int; 6], |
| 154 | } |
Alexander Polakov | 440bd53 | 2015-11-07 15:42:38 +0300 | [diff] [blame] | 155 | |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 156 | pub struct dqblk { |
| 157 | pub dqb_bhardlimit: ::uint64_t, |
| 158 | pub dqb_bsoftlimit: ::uint64_t, |
| 159 | pub dqb_curspace: ::uint64_t, |
| 160 | pub dqb_ihardlimit: ::uint64_t, |
| 161 | pub dqb_isoftlimit: ::uint64_t, |
| 162 | pub dqb_curinodes: ::uint64_t, |
| 163 | pub dqb_btime: ::uint64_t, |
| 164 | pub dqb_itime: ::uint64_t, |
| 165 | pub dqb_valid: ::uint32_t, |
| 166 | } |
| 167 | |
| 168 | pub struct signalfd_siginfo { |
| 169 | pub ssi_signo: ::uint32_t, |
| 170 | pub ssi_errno: ::int32_t, |
| 171 | pub ssi_code: ::int32_t, |
| 172 | pub ssi_pid: ::uint32_t, |
| 173 | pub ssi_uid: ::uint32_t, |
| 174 | pub ssi_fd: ::int32_t, |
| 175 | pub ssi_tid: ::uint32_t, |
| 176 | pub ssi_band: ::uint32_t, |
| 177 | pub ssi_overrun: ::uint32_t, |
| 178 | pub ssi_trapno: ::uint32_t, |
| 179 | pub ssi_status: ::int32_t, |
| 180 | pub ssi_int: ::int32_t, |
| 181 | pub ssi_ptr: ::uint64_t, |
| 182 | pub ssi_utime: ::uint64_t, |
| 183 | pub ssi_stime: ::uint64_t, |
| 184 | pub ssi_addr: ::uint64_t, |
| 185 | _pad: [::uint8_t; 48], |
| 186 | } |
| 187 | |
| 188 | pub struct fsid_t { |
| 189 | __val: [::c_int; 2], |
| 190 | } |
| 191 | |
| 192 | pub struct mq_attr { |
| 193 | pub mq_flags: ::c_long, |
| 194 | pub mq_maxmsg: ::c_long, |
| 195 | pub mq_msgsize: ::c_long, |
| 196 | pub mq_curmsgs: ::c_long, |
| 197 | pad: [::c_long; 4] |
| 198 | } |
| 199 | |
| 200 | pub struct cpu_set_t { |
| 201 | #[cfg(target_pointer_width = "32")] |
| 202 | bits: [u32; 32], |
| 203 | #[cfg(target_pointer_width = "64")] |
| 204 | bits: [u64; 16], |
| 205 | } |
Charles J. Schneider | 332bd86 | 2016-07-12 09:32:42 +0200 | [diff] [blame] | 206 | |
| 207 | pub struct if_nameindex { |
| 208 | pub if_index: ::c_uint, |
| 209 | pub if_name: *mut ::c_char, |
| 210 | } |
| 211 | |
Alexander Schlarb | 7590565 | 2016-09-17 22:17:17 +0200 | [diff] [blame] | 212 | // System V IPC |
| 213 | pub struct msginfo { |
| 214 | pub msgpool: ::c_int, |
| 215 | pub msgmap: ::c_int, |
| 216 | pub msgmax: ::c_int, |
| 217 | pub msgmnb: ::c_int, |
| 218 | pub msgmni: ::c_int, |
| 219 | pub msgssz: ::c_int, |
| 220 | pub msgtql: ::c_int, |
| 221 | pub msgseg: ::c_ushort, |
| 222 | } |
NODA, Kai | 61c23fb | 2016-04-10 22:21:55 +0800 | [diff] [blame] | 223 | |
| 224 | pub struct mmsghdr { |
| 225 | pub msg_hdr: ::msghdr, |
| 226 | pub msg_len: ::c_uint, |
| 227 | } |
Andrew Salmon | 548e4cf | 2017-05-26 04:35:40 -0700 | [diff] [blame] | 228 | |
| 229 | pub struct sembuf { |
Andrew Salmon | bc48202 | 2017-05-26 12:47:53 -0700 | [diff] [blame] | 230 | pub sem_num: ::c_ushort, |
| 231 | pub sem_op: ::c_short, |
Andrew Salmon | 0f93f37 | 2017-05-26 12:54:03 -0700 | [diff] [blame] | 232 | pub sem_flg: ::c_short, |
Andrew Salmon | 548e4cf | 2017-05-26 04:35:40 -0700 | [diff] [blame] | 233 | } |
| 234 | |
Andrew Salmon | 41f9e7c | 2017-05-26 13:24:11 -0700 | [diff] [blame^] | 235 | // FIXME |
Andrew Salmon | 548e4cf | 2017-05-26 04:35:40 -0700 | [diff] [blame] | 236 | pub struct semid_ds { |
Andrew Salmon | 41f9e7c | 2017-05-26 13:24:11 -0700 | [diff] [blame^] | 237 | // pub sem_perm: ::ipc_perm, |
| 238 | // pub sem_otime: ::time_t, |
| 239 | // pub sem_ctime: ::time_t, |
| 240 | // pub sem_nsems: ::c_ulong, |
Andrew Salmon | 548e4cf | 2017-05-26 04:35:40 -0700 | [diff] [blame] | 241 | } |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 242 | } |
| 243 | |
A.J. Gardner | 24c84f1 | 2016-03-31 20:08:03 -0500 | [diff] [blame] | 244 | pub const ABDAY_1: ::nl_item = 0x20000; |
| 245 | pub const ABDAY_2: ::nl_item = 0x20001; |
| 246 | pub const ABDAY_3: ::nl_item = 0x20002; |
| 247 | pub const ABDAY_4: ::nl_item = 0x20003; |
| 248 | pub const ABDAY_5: ::nl_item = 0x20004; |
| 249 | pub const ABDAY_6: ::nl_item = 0x20005; |
| 250 | pub const ABDAY_7: ::nl_item = 0x20006; |
| 251 | |
| 252 | pub const DAY_1: ::nl_item = 0x20007; |
| 253 | pub const DAY_2: ::nl_item = 0x20008; |
| 254 | pub const DAY_3: ::nl_item = 0x20009; |
| 255 | pub const DAY_4: ::nl_item = 0x2000A; |
| 256 | pub const DAY_5: ::nl_item = 0x2000B; |
| 257 | pub const DAY_6: ::nl_item = 0x2000C; |
| 258 | pub const DAY_7: ::nl_item = 0x2000D; |
| 259 | |
| 260 | pub const ABMON_1: ::nl_item = 0x2000E; |
| 261 | pub const ABMON_2: ::nl_item = 0x2000F; |
| 262 | pub const ABMON_3: ::nl_item = 0x20010; |
| 263 | pub const ABMON_4: ::nl_item = 0x20011; |
| 264 | pub const ABMON_5: ::nl_item = 0x20012; |
| 265 | pub const ABMON_6: ::nl_item = 0x20013; |
| 266 | pub const ABMON_7: ::nl_item = 0x20014; |
| 267 | pub const ABMON_8: ::nl_item = 0x20015; |
| 268 | pub const ABMON_9: ::nl_item = 0x20016; |
| 269 | pub const ABMON_10: ::nl_item = 0x20017; |
| 270 | pub const ABMON_11: ::nl_item = 0x20018; |
| 271 | pub const ABMON_12: ::nl_item = 0x20019; |
| 272 | |
| 273 | pub const MON_1: ::nl_item = 0x2001A; |
| 274 | pub const MON_2: ::nl_item = 0x2001B; |
| 275 | pub const MON_3: ::nl_item = 0x2001C; |
| 276 | pub const MON_4: ::nl_item = 0x2001D; |
| 277 | pub const MON_5: ::nl_item = 0x2001E; |
| 278 | pub const MON_6: ::nl_item = 0x2001F; |
| 279 | pub const MON_7: ::nl_item = 0x20020; |
| 280 | pub const MON_8: ::nl_item = 0x20021; |
| 281 | pub const MON_9: ::nl_item = 0x20022; |
| 282 | pub const MON_10: ::nl_item = 0x20023; |
| 283 | pub const MON_11: ::nl_item = 0x20024; |
| 284 | pub const MON_12: ::nl_item = 0x20025; |
| 285 | |
| 286 | pub const AM_STR: ::nl_item = 0x20026; |
| 287 | pub const PM_STR: ::nl_item = 0x20027; |
| 288 | |
| 289 | pub const D_T_FMT: ::nl_item = 0x20028; |
| 290 | pub const D_FMT: ::nl_item = 0x20029; |
| 291 | pub const T_FMT: ::nl_item = 0x2002A; |
| 292 | pub const T_FMT_AMPM: ::nl_item = 0x2002B; |
| 293 | |
| 294 | pub const ERA: ::nl_item = 0x2002C; |
| 295 | pub const ERA_D_FMT: ::nl_item = 0x2002E; |
| 296 | pub const ALT_DIGITS: ::nl_item = 0x2002F; |
| 297 | pub const ERA_D_T_FMT: ::nl_item = 0x20030; |
| 298 | pub const ERA_T_FMT: ::nl_item = 0x20031; |
| 299 | |
| 300 | pub const CODESET: ::nl_item = 14; |
| 301 | |
| 302 | pub const CRNCYSTR: ::nl_item = 0x4000F; |
| 303 | |
Ian Denhardt | 0ecafc3 | 2016-10-03 20:08:12 -0400 | [diff] [blame] | 304 | pub const RUSAGE_THREAD: ::c_int = 1; |
| 305 | pub const RUSAGE_CHILDREN: ::c_int = -1; |
| 306 | |
A.J. Gardner | 24c84f1 | 2016-03-31 20:08:03 -0500 | [diff] [blame] | 307 | pub const RADIXCHAR: ::nl_item = 0x10000; |
| 308 | pub const THOUSEP: ::nl_item = 0x10001; |
| 309 | |
| 310 | pub const YESEXPR: ::nl_item = 0x50000; |
| 311 | pub const NOEXPR: ::nl_item = 0x50001; |
| 312 | pub const YESSTR: ::nl_item = 0x50002; |
| 313 | pub const NOSTR: ::nl_item = 0x50003; |
| 314 | |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 315 | pub const FILENAME_MAX: ::c_uint = 4096; |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 316 | pub const L_tmpnam: ::c_uint = 20; |
Philipp Keller | 2cad6ca | 2016-07-06 21:15:38 +0200 | [diff] [blame] | 317 | pub const _PC_LINK_MAX: ::c_int = 0; |
| 318 | pub const _PC_MAX_CANON: ::c_int = 1; |
| 319 | pub const _PC_MAX_INPUT: ::c_int = 2; |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 320 | pub const _PC_NAME_MAX: ::c_int = 3; |
Philipp Keller | 2cad6ca | 2016-07-06 21:15:38 +0200 | [diff] [blame] | 321 | pub const _PC_PATH_MAX: ::c_int = 4; |
| 322 | pub const _PC_PIPE_BUF: ::c_int = 5; |
| 323 | pub const _PC_CHOWN_RESTRICTED: ::c_int = 6; |
| 324 | pub const _PC_NO_TRUNC: ::c_int = 7; |
| 325 | pub const _PC_VDISABLE: ::c_int = 8; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 326 | |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 327 | pub const _SC_ARG_MAX: ::c_int = 0; |
| 328 | pub const _SC_CHILD_MAX: ::c_int = 1; |
| 329 | pub const _SC_CLK_TCK: ::c_int = 2; |
| 330 | pub const _SC_NGROUPS_MAX: ::c_int = 3; |
| 331 | pub const _SC_OPEN_MAX: ::c_int = 4; |
| 332 | pub const _SC_STREAM_MAX: ::c_int = 5; |
| 333 | pub const _SC_TZNAME_MAX: ::c_int = 6; |
| 334 | pub const _SC_JOB_CONTROL: ::c_int = 7; |
| 335 | pub const _SC_SAVED_IDS: ::c_int = 8; |
| 336 | pub const _SC_REALTIME_SIGNALS: ::c_int = 9; |
| 337 | pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10; |
| 338 | pub const _SC_TIMERS: ::c_int = 11; |
| 339 | pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12; |
| 340 | pub const _SC_PRIORITIZED_IO: ::c_int = 13; |
| 341 | pub const _SC_SYNCHRONIZED_IO: ::c_int = 14; |
| 342 | pub const _SC_FSYNC: ::c_int = 15; |
| 343 | pub const _SC_MAPPED_FILES: ::c_int = 16; |
| 344 | pub const _SC_MEMLOCK: ::c_int = 17; |
| 345 | pub const _SC_MEMLOCK_RANGE: ::c_int = 18; |
| 346 | pub const _SC_MEMORY_PROTECTION: ::c_int = 19; |
| 347 | pub const _SC_MESSAGE_PASSING: ::c_int = 20; |
| 348 | pub const _SC_SEMAPHORES: ::c_int = 21; |
| 349 | pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22; |
| 350 | pub const _SC_AIO_LISTIO_MAX: ::c_int = 23; |
| 351 | pub const _SC_AIO_MAX: ::c_int = 24; |
| 352 | pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25; |
| 353 | pub const _SC_DELAYTIMER_MAX: ::c_int = 26; |
| 354 | pub const _SC_MQ_OPEN_MAX: ::c_int = 27; |
| 355 | pub const _SC_MQ_PRIO_MAX: ::c_int = 28; |
| 356 | pub const _SC_VERSION: ::c_int = 29; |
| 357 | pub const _SC_PAGESIZE: ::c_int = 30; |
Brian Campbell | 11f29f5 | 2016-01-31 21:28:16 -0500 | [diff] [blame] | 358 | pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 359 | pub const _SC_RTSIG_MAX: ::c_int = 31; |
| 360 | pub const _SC_SEM_NSEMS_MAX: ::c_int = 32; |
| 361 | pub const _SC_SEM_VALUE_MAX: ::c_int = 33; |
| 362 | pub const _SC_SIGQUEUE_MAX: ::c_int = 34; |
| 363 | pub const _SC_TIMER_MAX: ::c_int = 35; |
| 364 | pub const _SC_BC_BASE_MAX: ::c_int = 36; |
| 365 | pub const _SC_BC_DIM_MAX: ::c_int = 37; |
| 366 | pub const _SC_BC_SCALE_MAX: ::c_int = 38; |
| 367 | pub const _SC_BC_STRING_MAX: ::c_int = 39; |
| 368 | pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40; |
| 369 | pub const _SC_EXPR_NEST_MAX: ::c_int = 42; |
| 370 | pub const _SC_LINE_MAX: ::c_int = 43; |
| 371 | pub const _SC_RE_DUP_MAX: ::c_int = 44; |
| 372 | pub const _SC_2_VERSION: ::c_int = 46; |
| 373 | pub const _SC_2_C_BIND: ::c_int = 47; |
| 374 | pub const _SC_2_C_DEV: ::c_int = 48; |
| 375 | pub const _SC_2_FORT_DEV: ::c_int = 49; |
| 376 | pub const _SC_2_FORT_RUN: ::c_int = 50; |
| 377 | pub const _SC_2_SW_DEV: ::c_int = 51; |
| 378 | pub const _SC_2_LOCALEDEF: ::c_int = 52; |
| 379 | pub const _SC_IOV_MAX: ::c_int = 60; |
| 380 | pub const _SC_THREADS: ::c_int = 67; |
| 381 | pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68; |
| 382 | pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69; |
| 383 | pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70; |
| 384 | pub const _SC_LOGIN_NAME_MAX: ::c_int = 71; |
| 385 | pub const _SC_TTY_NAME_MAX: ::c_int = 72; |
| 386 | pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73; |
| 387 | pub const _SC_THREAD_KEYS_MAX: ::c_int = 74; |
| 388 | pub const _SC_THREAD_STACK_MIN: ::c_int = 75; |
| 389 | pub const _SC_THREAD_THREADS_MAX: ::c_int = 76; |
| 390 | pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77; |
| 391 | pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78; |
| 392 | pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79; |
| 393 | pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80; |
| 394 | pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81; |
| 395 | pub const _SC_NPROCESSORS_ONLN: ::c_int = 84; |
| 396 | pub const _SC_ATEXIT_MAX: ::c_int = 87; |
| 397 | pub const _SC_XOPEN_VERSION: ::c_int = 89; |
| 398 | pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90; |
| 399 | pub const _SC_XOPEN_UNIX: ::c_int = 91; |
| 400 | pub const _SC_XOPEN_CRYPT: ::c_int = 92; |
| 401 | pub const _SC_XOPEN_ENH_I18N: ::c_int = 93; |
| 402 | pub const _SC_XOPEN_SHM: ::c_int = 94; |
| 403 | pub const _SC_2_CHAR_TERM: ::c_int = 95; |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 404 | pub const _SC_2_UPE: ::c_int = 97; |
| 405 | pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125; |
| 406 | pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126; |
| 407 | pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128; |
| 408 | pub const _SC_XOPEN_LEGACY: ::c_int = 129; |
| 409 | pub const _SC_XOPEN_REALTIME: ::c_int = 130; |
| 410 | pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131; |
Raphael Cohn | f365111 | 2016-05-04 10:35:08 +0100 | [diff] [blame] | 411 | pub const _SC_HOST_NAME_MAX: ::c_int = 180; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 412 | |
| 413 | pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY; |
| 414 | pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY; |
| 415 | |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 416 | pub const GLOB_ERR: ::c_int = 1 << 0; |
| 417 | pub const GLOB_MARK: ::c_int = 1 << 1; |
| 418 | pub const GLOB_NOSORT: ::c_int = 1 << 2; |
| 419 | pub const GLOB_DOOFFS: ::c_int = 1 << 3; |
| 420 | pub const GLOB_NOCHECK: ::c_int = 1 << 4; |
| 421 | pub const GLOB_APPEND: ::c_int = 1 << 5; |
| 422 | pub const GLOB_NOESCAPE: ::c_int = 1 << 6; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 423 | |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 424 | pub const GLOB_NOSPACE: ::c_int = 1; |
| 425 | pub const GLOB_ABORTED: ::c_int = 2; |
| 426 | pub const GLOB_NOMATCH: ::c_int = 3; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 427 | |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 428 | pub const POSIX_MADV_NORMAL: ::c_int = 0; |
| 429 | pub const POSIX_MADV_RANDOM: ::c_int = 1; |
| 430 | pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; |
| 431 | pub const POSIX_MADV_WILLNEED: ::c_int = 3; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 432 | |
| 433 | pub const S_IEXEC: mode_t = 64; |
| 434 | pub const S_IWRITE: mode_t = 128; |
| 435 | pub const S_IREAD: mode_t = 256; |
| 436 | |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 437 | pub const F_LOCK: ::c_int = 1; |
| 438 | pub const F_TEST: ::c_int = 3; |
| 439 | pub const F_TLOCK: ::c_int = 2; |
| 440 | pub const F_ULOCK: ::c_int = 0; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 441 | |
Dan Burkert | 85a76f8 | 2015-11-04 20:26:27 -0800 | [diff] [blame] | 442 | pub const ST_RDONLY: ::c_ulong = 1; |
| 443 | pub const ST_NOSUID: ::c_ulong = 2; |
| 444 | pub const ST_NODEV: ::c_ulong = 4; |
| 445 | pub const ST_NOEXEC: ::c_ulong = 8; |
| 446 | pub const ST_SYNCHRONOUS: ::c_ulong = 16; |
| 447 | pub const ST_MANDLOCK: ::c_ulong = 64; |
| 448 | pub const ST_WRITE: ::c_ulong = 128; |
| 449 | pub const ST_APPEND: ::c_ulong = 256; |
| 450 | pub const ST_IMMUTABLE: ::c_ulong = 512; |
| 451 | pub const ST_NOATIME: ::c_ulong = 1024; |
| 452 | pub const ST_NODIRATIME: ::c_ulong = 2048; |
| 453 | |
Dong Zhou | 188bef6 | 2015-11-29 22:24:10 -0500 | [diff] [blame] | 454 | pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void; |
| 455 | pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; |
Alex Crichton | 29de598 | 2016-02-04 13:48:13 -0800 | [diff] [blame] | 456 | pub const RTLD_NODELETE: ::c_int = 0x1000; |
| 457 | pub const RTLD_NOW: ::c_int = 0x2; |
Dong Zhou | 51ed574 | 2015-11-29 21:42:14 -0500 | [diff] [blame] | 458 | |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 459 | pub const TCP_MD5SIG: ::c_int = 14; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 460 | |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 461 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { |
| 462 | __align: [], |
| 463 | size: [0; __SIZEOF_PTHREAD_MUTEX_T], |
| 464 | }; |
| 465 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { |
| 466 | __align: [], |
| 467 | size: [0; __SIZEOF_PTHREAD_COND_T], |
| 468 | }; |
| 469 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { |
| 470 | __align: [], |
| 471 | size: [0; __SIZEOF_PTHREAD_RWLOCK_T], |
| 472 | }; |
Amanieu d'Antras | b2b9f29 | 2016-05-21 06:40:14 +0100 | [diff] [blame] | 473 | pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 474 | pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; |
Amanieu d'Antras | b2b9f29 | 2016-05-21 06:40:14 +0100 | [diff] [blame] | 475 | pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; |
| 476 | pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 477 | pub const __SIZEOF_PTHREAD_COND_T: usize = 48; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 478 | |
Alexander Polakov | 26974c7 | 2015-11-27 03:02:44 +0300 | [diff] [blame] | 479 | pub const SCHED_OTHER: ::c_int = 0; |
| 480 | pub const SCHED_FIFO: ::c_int = 1; |
| 481 | pub const SCHED_RR: ::c_int = 2; |
| 482 | pub const SCHED_BATCH: ::c_int = 3; |
| 483 | pub const SCHED_IDLE: ::c_int = 5; |
| 484 | |
Zac Berkowitz | 1479ea8 | 2017-02-28 03:59:17 +0000 | [diff] [blame] | 485 | pub const AF_IB: ::c_int = 27; |
| 486 | pub const AF_MPLS: ::c_int = 28; |
| 487 | pub const AF_NFC: ::c_int = 39; |
| 488 | pub const AF_VSOCK: ::c_int = 40; |
Zac Berkowitz | 985ea40 | 2017-03-01 15:39:24 +0000 | [diff] [blame] | 489 | #[doc(hidden)] |
Zac Berkowitz | 1479ea8 | 2017-02-28 03:59:17 +0000 | [diff] [blame] | 490 | pub const AF_MAX: ::c_int = 42; |
| 491 | pub const PF_IB: ::c_int = AF_IB; |
| 492 | pub const PF_MPLS: ::c_int = AF_MPLS; |
| 493 | pub const PF_NFC: ::c_int = AF_NFC; |
| 494 | pub const PF_VSOCK: ::c_int = AF_VSOCK; |
Zac Berkowitz | 985ea40 | 2017-03-01 15:39:24 +0000 | [diff] [blame] | 495 | #[doc(hidden)] |
Zac Berkowitz | 1479ea8 | 2017-02-28 03:59:17 +0000 | [diff] [blame] | 496 | pub const PF_MAX: ::c_int = AF_MAX; |
| 497 | |
Alexander Schlarb | 7590565 | 2016-09-17 22:17:17 +0200 | [diff] [blame] | 498 | // System V IPC |
| 499 | pub const IPC_PRIVATE: ::key_t = 0; |
| 500 | |
Alexander Polakov | 5850156 | 2015-12-14 02:09:45 +0300 | [diff] [blame] | 501 | pub const IPC_CREAT: ::c_int = 0o1000; |
| 502 | pub const IPC_EXCL: ::c_int = 0o2000; |
| 503 | pub const IPC_NOWAIT: ::c_int = 0o4000; |
| 504 | |
| 505 | pub const IPC_RMID: ::c_int = 0; |
| 506 | pub const IPC_SET: ::c_int = 1; |
| 507 | pub const IPC_STAT: ::c_int = 2; |
| 508 | pub const IPC_INFO: ::c_int = 3; |
Alexander Schlarb | 7590565 | 2016-09-17 22:17:17 +0200 | [diff] [blame] | 509 | pub const MSG_STAT: ::c_int = 11; |
| 510 | pub const MSG_INFO: ::c_int = 12; |
| 511 | |
| 512 | pub const MSG_NOERROR: ::c_int = 0o10000; |
| 513 | pub const MSG_EXCEPT: ::c_int = 0o20000; |
| 514 | pub const MSG_COPY: ::c_int = 0o40000; |
Alexander Polakov | 5850156 | 2015-12-14 02:09:45 +0300 | [diff] [blame] | 515 | |
| 516 | pub const SHM_R: ::c_int = 0o400; |
| 517 | pub const SHM_W: ::c_int = 0o200; |
| 518 | |
| 519 | pub const SHM_RDONLY: ::c_int = 0o10000; |
| 520 | pub const SHM_RND: ::c_int = 0o20000; |
| 521 | pub const SHM_REMAP: ::c_int = 0o40000; |
| 522 | pub const SHM_EXEC: ::c_int = 0o100000; |
| 523 | |
| 524 | pub const SHM_LOCK: ::c_int = 11; |
| 525 | pub const SHM_UNLOCK: ::c_int = 12; |
| 526 | |
| 527 | pub const SHM_HUGETLB: ::c_int = 0o4000; |
| 528 | pub const SHM_NORESERVE: ::c_int = 0o10000; |
| 529 | |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 530 | pub const EPOLLRDHUP: ::c_int = 0x2000; |
Simon Liu | d6fbc0d | 2017-02-17 23:25:19 +0800 | [diff] [blame] | 531 | pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 532 | pub const EPOLLONESHOT: ::c_int = 0x40000000; |
| 533 | |
| 534 | pub const QFMT_VFS_OLD: ::c_int = 1; |
| 535 | pub const QFMT_VFS_V0: ::c_int = 2; |
| 536 | |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 537 | pub const EFD_SEMAPHORE: ::c_int = 0x1; |
| 538 | |
Raphael Cohn | 1c6c0ca | 2016-05-05 17:45:29 +0100 | [diff] [blame] | 539 | pub const LOG_NFACILITIES: ::c_int = 24; |
| 540 | |
Steven Fackler | 41699f7 | 2016-06-03 21:02:56 -0700 | [diff] [blame] | 541 | pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t; |
| 542 | |
Philipp Matthias Schaefer | 5a68b6a | 2016-07-15 23:19:00 +0200 | [diff] [blame] | 543 | pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32; |
| 544 | pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32; |
| 545 | pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32; |
| 546 | pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32; |
| 547 | pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32; |
| 548 | pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32; |
| 549 | pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32; |
Sergey Bugaev | 5d65c3f | 2016-07-12 20:55:08 +0300 | [diff] [blame] | 550 | |
Stefan Luecke | d37d42a | 2016-12-20 15:29:17 +0100 | [diff] [blame] | 551 | pub const AI_PASSIVE: ::c_int = 0x0001; |
| 552 | pub const AI_CANONNAME: ::c_int = 0x0002; |
| 553 | pub const AI_NUMERICHOST: ::c_int = 0x0004; |
| 554 | pub const AI_V4MAPPED: ::c_int = 0x0008; |
| 555 | pub const AI_ALL: ::c_int = 0x0010; |
| 556 | pub const AI_ADDRCONFIG: ::c_int = 0x0020; |
| 557 | |
| 558 | pub const AI_NUMERICSERV: ::c_int = 0x0400; |
| 559 | |
| 560 | pub const EAI_BADFLAGS: ::c_int = -1; |
| 561 | pub const EAI_NONAME: ::c_int = -2; |
| 562 | pub const EAI_AGAIN: ::c_int = -3; |
| 563 | pub const EAI_FAIL: ::c_int = -4; |
| 564 | pub const EAI_FAMILY: ::c_int = -6; |
| 565 | pub const EAI_SOCKTYPE: ::c_int = -7; |
| 566 | pub const EAI_SERVICE: ::c_int = -8; |
| 567 | pub const EAI_MEMORY: ::c_int = -10; |
| 568 | pub const EAI_OVERFLOW: ::c_int = -12; |
| 569 | |
| 570 | pub const NI_NUMERICHOST: ::c_int = 1; |
| 571 | pub const NI_NUMERICSERV: ::c_int = 2; |
| 572 | pub const NI_NOFQDN: ::c_int = 4; |
| 573 | pub const NI_NAMEREQD: ::c_int = 8; |
| 574 | pub const NI_DGRAM: ::c_int = 16; |
| 575 | |
Chris Kaminski | ae6cbcd | 2016-09-07 13:15:49 -0400 | [diff] [blame] | 576 | pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1; |
| 577 | pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2; |
| 578 | pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4; |
Chris Kaminski | 37552b7 | 2016-09-06 20:20:00 -0400 | [diff] [blame] | 579 | |
Tomasz MiÄ…sko | f514d46 | 2016-09-19 12:29:45 +0200 | [diff] [blame] | 580 | pub const EAI_SYSTEM: ::c_int = -11; |
| 581 | |
Alan Somers | 804763c | 2016-11-13 15:03:14 -0700 | [diff] [blame] | 582 | pub const AIO_CANCELED: ::c_int = 0; |
| 583 | pub const AIO_NOTCANCELED: ::c_int = 1; |
| 584 | pub const AIO_ALLDONE: ::c_int = 2; |
| 585 | pub const LIO_READ: ::c_int = 0; |
| 586 | pub const LIO_WRITE: ::c_int = 1; |
| 587 | pub const LIO_NOP: ::c_int = 2; |
| 588 | pub const LIO_WAIT: ::c_int = 0; |
| 589 | pub const LIO_NOWAIT: ::c_int = 1; |
| 590 | |
sankaku | 545f67d | 2016-12-27 18:40:18 -0500 | [diff] [blame] | 591 | pub const MREMAP_MAYMOVE: ::c_int = 1; |
| 592 | pub const MREMAP_FIXED: ::c_int = 2; |
| 593 | |
zethra | 1887630 | 2016-12-28 16:59:35 -0500 | [diff] [blame] | 594 | pub const PR_SET_PDEATHSIG: ::c_int = 1; |
| 595 | pub const PR_GET_PDEATHSIG: ::c_int = 2; |
| 596 | |
| 597 | pub const PR_GET_DUMPABLE: ::c_int = 3; |
| 598 | pub const PR_SET_DUMPABLE: ::c_int = 4; |
| 599 | |
| 600 | pub const PR_GET_UNALIGN: ::c_int = 5; |
| 601 | pub const PR_SET_UNALIGN: ::c_int = 6; |
| 602 | pub const PR_UNALIGN_NOPRINT: ::c_int = 1; |
| 603 | pub const PR_UNALIGN_SIGBUS: ::c_int = 2; |
| 604 | |
| 605 | pub const PR_GET_KEEPCAPS: ::c_int = 7; |
| 606 | pub const PR_SET_KEEPCAPS: ::c_int = 8; |
| 607 | |
| 608 | pub const PR_GET_FPEMU: ::c_int = 9; |
| 609 | pub const PR_SET_FPEMU: ::c_int = 10; |
| 610 | pub const PR_FPEMU_NOPRINT: ::c_int = 1; |
| 611 | pub const PR_FPEMU_SIGFPE: ::c_int = 2; |
| 612 | |
| 613 | pub const PR_GET_FPEXC: ::c_int = 11; |
| 614 | pub const PR_SET_FPEXC: ::c_int = 12; |
| 615 | pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80; |
| 616 | pub const PR_FP_EXC_DIV: ::c_int = 0x010000; |
| 617 | pub const PR_FP_EXC_OVF: ::c_int = 0x020000; |
| 618 | pub const PR_FP_EXC_UND: ::c_int = 0x040000; |
| 619 | pub const PR_FP_EXC_RES: ::c_int = 0x080000; |
| 620 | pub const PR_FP_EXC_INV: ::c_int = 0x100000; |
| 621 | pub const PR_FP_EXC_DISABLED: ::c_int = 0; |
| 622 | pub const PR_FP_EXC_NONRECOV: ::c_int = 1; |
| 623 | pub const PR_FP_EXC_ASYNC: ::c_int = 2; |
| 624 | pub const PR_FP_EXC_PRECISE: ::c_int = 3; |
| 625 | |
| 626 | pub const PR_GET_TIMING: ::c_int = 13; |
| 627 | pub const PR_SET_TIMING: ::c_int = 14; |
| 628 | pub const PR_TIMING_STATISTICAL: ::c_int = 0; |
| 629 | pub const PR_TIMING_TIMESTAMP: ::c_int = 1; |
| 630 | |
| 631 | pub const PR_SET_NAME: ::c_int = 15; |
| 632 | pub const PR_GET_NAME: ::c_int = 16; |
| 633 | |
| 634 | pub const PR_GET_ENDIAN: ::c_int = 19; |
| 635 | pub const PR_SET_ENDIAN: ::c_int = 20; |
| 636 | pub const PR_ENDIAN_BIG: ::c_int = 0; |
| 637 | pub const PR_ENDIAN_LITTLE: ::c_int = 1; |
| 638 | pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2; |
| 639 | |
| 640 | pub const PR_GET_SECCOMP: ::c_int = 21; |
| 641 | pub const PR_SET_SECCOMP: ::c_int = 22; |
| 642 | |
| 643 | pub const PR_CAPBSET_READ: ::c_int = 23; |
| 644 | pub const PR_CAPBSET_DROP: ::c_int = 24; |
| 645 | |
| 646 | pub const PR_GET_TSC: ::c_int = 25; |
| 647 | pub const PR_SET_TSC: ::c_int = 26; |
| 648 | pub const PR_TSC_ENABLE: ::c_int = 1; |
| 649 | pub const PR_TSC_SIGSEGV: ::c_int = 2; |
| 650 | |
| 651 | pub const PR_GET_SECUREBITS: ::c_int = 27; |
| 652 | pub const PR_SET_SECUREBITS: ::c_int = 28; |
| 653 | |
| 654 | pub const PR_SET_TIMERSLACK: ::c_int = 29; |
| 655 | pub const PR_GET_TIMERSLACK: ::c_int = 30; |
| 656 | |
| 657 | pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31; |
| 658 | pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32; |
| 659 | |
| 660 | pub const PR_MCE_KILL: ::c_int = 33; |
| 661 | pub const PR_MCE_KILL_CLEAR: ::c_int = 0; |
| 662 | pub const PR_MCE_KILL_SET: ::c_int = 1; |
| 663 | |
| 664 | pub const PR_MCE_KILL_LATE: ::c_int = 0; |
| 665 | pub const PR_MCE_KILL_EARLY: ::c_int = 1; |
| 666 | pub const PR_MCE_KILL_DEFAULT: ::c_int = 2; |
| 667 | |
| 668 | pub const PR_MCE_KILL_GET: ::c_int = 34; |
| 669 | |
| 670 | pub const PR_SET_MM: ::c_int = 35; |
| 671 | pub const PR_SET_MM_START_CODE: ::c_int = 1; |
| 672 | pub const PR_SET_MM_END_CODE: ::c_int = 2; |
| 673 | pub const PR_SET_MM_START_DATA: ::c_int = 3; |
| 674 | pub const PR_SET_MM_END_DATA: ::c_int = 4; |
| 675 | pub const PR_SET_MM_START_STACK: ::c_int = 5; |
| 676 | pub const PR_SET_MM_START_BRK: ::c_int = 6; |
| 677 | pub const PR_SET_MM_BRK: ::c_int = 7; |
| 678 | pub const PR_SET_MM_ARG_START: ::c_int = 8; |
| 679 | pub const PR_SET_MM_ARG_END: ::c_int = 9; |
| 680 | pub const PR_SET_MM_ENV_START: ::c_int = 10; |
| 681 | pub const PR_SET_MM_ENV_END: ::c_int = 11; |
| 682 | pub const PR_SET_MM_AUXV: ::c_int = 12; |
| 683 | pub const PR_SET_MM_EXE_FILE: ::c_int = 13; |
| 684 | pub const PR_SET_MM_MAP: ::c_int = 14; |
| 685 | pub const PR_SET_MM_MAP_SIZE: ::c_int = 15; |
| 686 | |
| 687 | pub const PR_SET_PTRACER: ::c_int = 0x59616d61; |
| 688 | |
| 689 | pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36; |
| 690 | pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37; |
| 691 | |
| 692 | pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38; |
| 693 | pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39; |
| 694 | |
| 695 | pub const PR_GET_TID_ADDRESS: ::c_int = 40; |
| 696 | |
| 697 | pub const PR_SET_THP_DISABLE: ::c_int = 41; |
| 698 | pub const PR_GET_THP_DISABLE: ::c_int = 42; |
| 699 | |
| 700 | pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43; |
| 701 | pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44; |
| 702 | |
| 703 | pub const PR_SET_FP_MODE: ::c_int = 45; |
| 704 | pub const PR_GET_FP_MODE: ::c_int = 46; |
| 705 | pub const PR_FP_MODE_FR: ::c_int = 1 << 0; |
| 706 | pub const PR_FP_MODE_FRE: ::c_int = 1 << 1; |
| 707 | |
| 708 | pub const PR_CAP_AMBIENT: ::c_int = 47; |
| 709 | pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1; |
| 710 | pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2; |
| 711 | pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3; |
| 712 | pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4; |
| 713 | |
Lee Bousfield | 1a06678 | 2017-05-07 15:40:21 -0600 | [diff] [blame] | 714 | pub const XATTR_CREATE: ::c_int = 0x1; |
| 715 | pub const XATTR_REPLACE: ::c_int = 0x2; |
| 716 | |
Lee Bousfield | 98889cf | 2017-05-15 09:15:53 -0600 | [diff] [blame] | 717 | // On Linux, libc doesn't define this constant, libattr does instead. |
| 718 | // We still define it for Linux as it's defined by libc on other platforms, |
| 719 | // and it's mentioned in the man pages for getxattr and setxattr. |
| 720 | pub const ENOATTR: ::c_int = ::ENODATA; |
| 721 | |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 722 | f! { |
| 723 | pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { |
| 724 | for slot in cpuset.bits.iter_mut() { |
| 725 | *slot = 0; |
| 726 | } |
| 727 | } |
| 728 | |
| 729 | pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { |
NODA, Kai | afa77df | 2016-04-10 19:13:46 +0800 | [diff] [blame] | 730 | let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc |
| 731 | let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 732 | cpuset.bits[idx] |= 1 << offset; |
| 733 | () |
| 734 | } |
| 735 | |
Philipp Matthias Schaefer | 2def04a | 2016-08-18 21:47:08 +0200 | [diff] [blame] | 736 | pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { |
| 737 | let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc |
| 738 | let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); |
| 739 | cpuset.bits[idx] &= !(1 << offset); |
| 740 | () |
| 741 | } |
| 742 | |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 743 | pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { |
NODA, Kai | afa77df | 2016-04-10 19:13:46 +0800 | [diff] [blame] | 744 | let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); |
| 745 | let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 746 | 0 != (cpuset.bits[idx] & (1 << offset)) |
| 747 | } |
| 748 | |
| 749 | pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { |
| 750 | set1.bits == set2.bits |
| 751 | } |
Steven Fackler | dbdce80 | 2017-04-30 13:23:37 -0700 | [diff] [blame] | 752 | |
| 753 | pub fn major(dev: ::dev_t) -> ::c_uint { |
| 754 | let mut major = 0; |
| 755 | major |= (dev & 0x00000000000fff00) >> 8; |
| 756 | major |= (dev & 0xfffff00000000000) >> 32; |
| 757 | major as ::c_uint |
| 758 | } |
| 759 | |
| 760 | pub fn minor(dev: ::dev_t) -> ::c_uint { |
| 761 | let mut minor = 0; |
| 762 | minor |= (dev & 0xfffff00000000000) >> 0; |
| 763 | minor |= (dev & 0x00000ffffff00000) >> 12; |
| 764 | minor as ::c_uint |
| 765 | } |
| 766 | |
| 767 | pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t { |
| 768 | let major = major as ::dev_t; |
| 769 | let minor = minor as ::dev_t; |
| 770 | let mut dev = 0; |
| 771 | dev |= (major & 0x00000fff) << 8; |
| 772 | dev |= (major & 0xfffff000) << 32; |
| 773 | dev |= (minor & 0x000000ff) << 0; |
| 774 | dev |= (minor & 0xffffff00) << 12; |
| 775 | dev |
| 776 | } |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 777 | } |
| 778 | |
Raphael Cohn | 893d4d8 | 2016-05-08 11:40:57 +0100 | [diff] [blame] | 779 | extern { |
Alan Somers | e0ff0d6 | 2016-11-13 14:35:17 -0700 | [diff] [blame] | 780 | pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; |
| 781 | pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int; |
| 782 | pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int; |
| 783 | pub fn aio_error(aiocbp: *const aiocb) -> ::c_int; |
| 784 | pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t; |
| 785 | pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int, |
| 786 | timeout: *const ::timespec) -> ::c_int; |
| 787 | pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int; |
| 788 | pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb, |
| 789 | nitems: ::c_int, sevp: *mut ::sigevent) -> ::c_int; |
| 790 | |
knight42 | c289365 | 2016-08-28 00:32:35 +0800 | [diff] [blame] | 791 | pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; |
| 792 | |
Knight | 19fb32a | 2016-07-31 17:00:15 +0800 | [diff] [blame] | 793 | pub fn setpwent(); |
| 794 | pub fn getpwent() -> *mut passwd; |
Philipp Keller | 26f3eb9 | 2016-09-26 22:00:29 +0200 | [diff] [blame] | 795 | pub fn setspent(); |
| 796 | pub fn endspent(); |
| 797 | pub fn getspent() -> *mut spwd; |
| 798 | pub fn getspnam(__name: *const ::c_char) -> *mut spwd; |
| 799 | |
Alex Crichton | 5260587 | 2015-09-15 16:49:37 -0700 | [diff] [blame] | 800 | pub fn shm_open(name: *const c_char, oflag: ::c_int, |
| 801 | mode: mode_t) -> ::c_int; |
Alexander Schlarb | 7590565 | 2016-09-17 22:17:17 +0200 | [diff] [blame] | 802 | |
| 803 | // System V IPC |
Alexander Polakov | 5850156 | 2015-12-14 02:09:45 +0300 | [diff] [blame] | 804 | pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int; |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 805 | pub fn shmat(shmid: ::c_int, |
| 806 | shmaddr: *const ::c_void, |
| 807 | shmflg: ::c_int) -> *mut ::c_void; |
Alexander Polakov | 5850156 | 2015-12-14 02:09:45 +0300 | [diff] [blame] | 808 | pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int; |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 809 | pub fn shmctl(shmid: ::c_int, |
| 810 | cmd: ::c_int, |
| 811 | buf: *mut ::shmid_ds) -> ::c_int; |
Alexander Schlarb | 7590565 | 2016-09-17 22:17:17 +0200 | [diff] [blame] | 812 | pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t; |
Andrew Salmon | 548e4cf | 2017-05-26 04:35:40 -0700 | [diff] [blame] | 813 | pub fn semget(key: ::key_t, nsems: ::c_int, semflag: ::c_int) -> ::c_int; |
Andrew Salmon | 8239c0a | 2017-05-26 13:11:03 -0700 | [diff] [blame] | 814 | pub fn semop(semid: ::c_int, |
| 815 | sops: *mut ::sembuf, nsops: ::size_t) -> ::c_int; |
| 816 | pub fn semctl(semid: ::c_int, |
| 817 | semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int; |
Alexander Schlarb | 7590565 | 2016-09-17 22:17:17 +0200 | [diff] [blame] | 818 | pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int; |
| 819 | pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int; |
| 820 | pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, |
| 821 | msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t; |
| 822 | pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t, |
| 823 | msgflg: ::c_int) -> ::c_int; |
| 824 | |
Alex Crichton | 9d5b8b2 | 2015-09-15 17:14:23 -0700 | [diff] [blame] | 825 | pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) |
| 826 | -> ::c_int; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 827 | pub fn __errno_location() -> *mut ::c_int; |
Alex Crichton | 15b83c2 | 2015-09-17 17:25:52 -0700 | [diff] [blame] | 828 | |
Alex Crichton | 7482522 | 2015-10-29 17:36:55 -0700 | [diff] [blame] | 829 | pub fn fopen64(filename: *const c_char, |
| 830 | mode: *const c_char) -> *mut ::FILE; |
| 831 | pub fn freopen64(filename: *const c_char, mode: *const c_char, |
| 832 | file: *mut ::FILE) -> *mut ::FILE; |
| 833 | pub fn tmpfile64() -> *mut ::FILE; |
| 834 | pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int; |
| 835 | pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int; |
Alex Crichton | 7482522 | 2015-10-29 17:36:55 -0700 | [diff] [blame] | 836 | pub fn fseeko64(stream: *mut ::FILE, |
| 837 | offset: ::off64_t, |
| 838 | whence: ::c_int) -> ::c_int; |
| 839 | pub fn ftello64(stream: *mut ::FILE) -> ::off64_t; |
Dan Burkert | 0b46775 | 2015-11-03 20:58:44 -0800 | [diff] [blame] | 840 | pub fn fallocate(fd: ::c_int, mode: ::c_int, |
| 841 | offset: ::off_t, len: ::off_t) -> ::c_int; |
Dan Burkert | 44bba4c | 2015-11-03 21:02:46 -0800 | [diff] [blame] | 842 | pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, |
| 843 | len: ::off_t) -> ::c_int; |
Dan Burkert | fe3968f | 2015-11-04 22:20:29 -0800 | [diff] [blame] | 844 | pub fn readahead(fd: ::c_int, offset: ::off64_t, |
| 845 | count: ::size_t) -> ::ssize_t; |
Alexander Polakov | 30baed0 | 2015-12-01 15:29:05 +0300 | [diff] [blame] | 846 | pub fn getxattr(path: *const c_char, name: *const c_char, |
| 847 | value: *mut ::c_void, size: ::size_t) -> ::ssize_t; |
| 848 | pub fn lgetxattr(path: *const c_char, name: *const c_char, |
| 849 | value: *mut ::c_void, size: ::size_t) -> ::ssize_t; |
| 850 | pub fn fgetxattr(filedes: ::c_int, name: *const c_char, |
| 851 | value: *mut ::c_void, size: ::size_t) -> ::ssize_t; |
| 852 | pub fn setxattr(path: *const c_char, name: *const c_char, |
| 853 | value: *const ::c_void, size: ::size_t, |
| 854 | flags: ::c_int) -> ::c_int; |
| 855 | pub fn lsetxattr(path: *const c_char, name: *const c_char, |
| 856 | value: *const ::c_void, size: ::size_t, |
| 857 | flags: ::c_int) -> ::c_int; |
| 858 | pub fn fsetxattr(filedes: ::c_int, name: *const c_char, |
| 859 | value: *const ::c_void, size: ::size_t, |
| 860 | flags: ::c_int) -> ::c_int; |
| 861 | pub fn listxattr(path: *const c_char, list: *mut c_char, |
| 862 | size: ::size_t) -> ::ssize_t; |
| 863 | pub fn llistxattr(path: *const c_char, list: *mut c_char, |
| 864 | size: ::size_t) -> ::ssize_t; |
| 865 | pub fn flistxattr(filedes: ::c_int, list: *mut c_char, |
| 866 | size: ::size_t) -> ::ssize_t; |
| 867 | pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int; |
| 868 | pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int; |
| 869 | pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 870 | pub fn signalfd(fd: ::c_int, |
| 871 | mask: *const ::sigset_t, |
| 872 | flags: ::c_int) -> ::c_int; |
| 873 | pub fn pwritev(fd: ::c_int, |
| 874 | iov: *const ::iovec, |
| 875 | iovcnt: ::c_int, |
| 876 | offset: ::off_t) -> ::ssize_t; |
| 877 | pub fn preadv(fd: ::c_int, |
| 878 | iov: *const ::iovec, |
| 879 | iovcnt: ::c_int, |
| 880 | offset: ::off_t) -> ::ssize_t; |
| 881 | pub fn quotactl(cmd: ::c_int, |
| 882 | special: *const ::c_char, |
| 883 | id: ::c_int, |
| 884 | data: *mut ::c_char) -> ::c_int; |
| 885 | pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; |
| 886 | pub fn mq_close(mqd: ::mqd_t) -> ::c_int; |
| 887 | pub fn mq_unlink(name: *const ::c_char) -> ::c_int; |
| 888 | pub fn mq_receive(mqd: ::mqd_t, |
| 889 | msg_ptr: *mut ::c_char, |
| 890 | msg_len: ::size_t, |
| 891 | msq_prio: *mut ::c_uint) -> ::ssize_t; |
| 892 | pub fn mq_send(mqd: ::mqd_t, |
| 893 | msg_ptr: *const ::c_char, |
| 894 | msg_len: ::size_t, |
| 895 | msq_prio: ::c_uint) -> ::c_int; |
| 896 | pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; |
| 897 | pub fn mq_setattr(mqd: ::mqd_t, |
| 898 | newattr: *const ::mq_attr, |
| 899 | oldattr: *mut ::mq_attr) -> ::c_int; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 900 | pub fn epoll_pwait(epfd: ::c_int, |
| 901 | events: *mut ::epoll_event, |
| 902 | maxevents: ::c_int, |
| 903 | timeout: ::c_int, |
| 904 | sigmask: *const ::sigset_t) -> ::c_int; |
| 905 | pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 906 | pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; |
Kamal Marhubi | 511a780 | 2016-02-15 00:40:19 -0500 | [diff] [blame] | 907 | pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 908 | pub fn mkostemps(template: *mut ::c_char, |
| 909 | suffixlen: ::c_int, |
| 910 | flags: ::c_int) -> ::c_int; |
Philipp Matthias Schaefer | c1982a4 | 2016-02-28 16:06:45 +0100 | [diff] [blame] | 911 | pub fn sigtimedwait(set: *const sigset_t, |
| 912 | info: *mut siginfo_t, |
| 913 | timeout: *const ::timespec) -> ::c_int; |
| 914 | pub fn sigwaitinfo(set: *const sigset_t, |
| 915 | info: *mut siginfo_t) -> ::c_int; |
Kamal Marhubi | 9c4af10 | 2016-02-27 14:58:43 -0500 | [diff] [blame] | 916 | pub fn openpty(amaster: *mut ::c_int, |
| 917 | aslave: *mut ::c_int, |
| 918 | name: *mut ::c_char, |
| 919 | termp: *const termios, |
| 920 | winp: *const ::winsize) -> ::c_int; |
| 921 | pub fn forkpty(amaster: *mut ::c_int, |
| 922 | name: *mut ::c_char, |
| 923 | termp: *const termios, |
| 924 | winp: *const ::winsize) -> ::pid_t; |
A.J. Gardner | 24c84f1 | 2016-03-31 20:08:03 -0500 | [diff] [blame] | 925 | pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; |
Kamal Marhubi | b9750b6 | 2016-04-27 14:04:31 -0400 | [diff] [blame] | 926 | pub fn getnameinfo(sa: *const ::sockaddr, |
| 927 | salen: ::socklen_t, |
| 928 | host: *mut ::c_char, |
| 929 | hostlen: ::socklen_t, |
| 930 | serv: *mut ::c_char, |
| 931 | sevlen: ::socklen_t, |
| 932 | flags: ::c_int) -> ::c_int; |
Kamal Marhubi | 9569599 | 2016-04-27 14:29:19 -0400 | [diff] [blame] | 933 | pub fn prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit, |
| 934 | old_limit: *mut ::rlimit) -> ::c_int; |
| 935 | pub fn prlimit64(pid: ::pid_t, |
| 936 | resource: ::c_int, |
| 937 | new_limit: *const ::rlimit64, |
| 938 | old_limit: *mut ::rlimit64) -> ::c_int; |
Raphael Cohn | 72f1fb6 | 2016-05-11 18:06:14 +0100 | [diff] [blame] | 939 | pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; |
Julia Evans | c9496fe | 2016-05-11 08:44:27 -0400 | [diff] [blame] | 940 | pub fn process_vm_readv(pid: ::pid_t, |
| 941 | local_iov: *const ::iovec, |
| 942 | liovcnt: ::c_ulong, |
| 943 | remote_iov: *const ::iovec, |
| 944 | riovcnt: ::c_ulong, |
| 945 | flags: ::c_ulong) -> isize; |
| 946 | pub fn process_vm_writev(pid: ::pid_t, |
| 947 | local_iov: *const ::iovec, |
| 948 | liovcnt: ::c_ulong, |
| 949 | remote_iov: *const ::iovec, |
| 950 | riovcnt: ::c_ulong, |
| 951 | flags: ::c_ulong) -> isize; |
Sergey Bugaev | 8b76797 | 2016-07-12 20:56:43 +0300 | [diff] [blame] | 952 | pub fn reboot(how_to: ::c_int) -> ::c_int; |
Boris Faure | 28d0afa | 2016-11-05 21:19:53 +0100 | [diff] [blame] | 953 | pub fn setfsgid(gid: ::gid_t) -> ::c_int; |
| 954 | pub fn setfsuid(uid: ::uid_t) -> ::c_int; |
Dylan Reid | 519ffa0 | 2016-10-21 16:05:01 -0700 | [diff] [blame] | 955 | pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; |
| 956 | pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; |
Axel Viala | 26ee782 | 2016-06-10 02:33:32 +0200 | [diff] [blame] | 957 | |
| 958 | // Not available now on Android |
| 959 | pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, |
| 960 | mode: ::mode_t) -> ::c_int; |
Charles J. Schneider | 332bd86 | 2016-07-12 09:32:42 +0200 | [diff] [blame] | 961 | pub fn if_nameindex() -> *mut if_nameindex; |
| 962 | pub fn if_freenameindex(ptr: *mut if_nameindex); |
Chris Kaminski | 37552b7 | 2016-09-06 20:20:00 -0400 | [diff] [blame] | 963 | pub fn sync_file_range(fd: ::c_int, offset: ::off64_t, |
| 964 | nbytes: ::off64_t, flags: ::c_uint) -> ::c_int; |
Niels Sascha Reedijk | a3ff955 | 2016-02-02 21:21:36 +0100 | [diff] [blame] | 965 | pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; |
| 966 | pub fn freeifaddrs(ifa: *mut ::ifaddrs); |
sankaku | 545f67d | 2016-12-27 18:40:18 -0500 | [diff] [blame] | 967 | |
| 968 | pub fn mremap(addr: *mut ::c_void, |
| 969 | len: ::size_t, |
| 970 | new_len: ::size_t, |
| 971 | flags: ::c_int, |
| 972 | ...) -> *mut ::c_void; |
Marco A L Barbosa | fab2d30 | 2017-02-27 16:41:57 -0300 | [diff] [blame] | 973 | |
| 974 | pub fn glob(pattern: *const c_char, |
| 975 | flags: ::c_int, |
| 976 | errfunc: Option<extern fn(epath: *const c_char, |
| 977 | errno: ::c_int) -> ::c_int>, |
Marco A L Barbosa | a3759d7 | 2017-02-27 17:25:55 -0300 | [diff] [blame] | 978 | pglob: *mut ::glob_t) -> ::c_int; |
| 979 | pub fn globfree(pglob: *mut ::glob_t); |
Marco A L Barbosa | fab2d30 | 2017-02-27 16:41:57 -0300 | [diff] [blame] | 980 | |
| 981 | pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) |
| 982 | -> ::c_int; |
| 983 | |
Marco A L Barbosa | a3759d7 | 2017-02-27 17:25:55 -0300 | [diff] [blame] | 984 | pub fn shm_unlink(name: *const ::c_char) -> ::c_int; |
Marco A L Barbosa | fab2d30 | 2017-02-27 16:41:57 -0300 | [diff] [blame] | 985 | |
Marco A L Barbosa | a3759d7 | 2017-02-27 17:25:55 -0300 | [diff] [blame] | 986 | pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); |
Marco A L Barbosa | fab2d30 | 2017-02-27 16:41:57 -0300 | [diff] [blame] | 987 | |
Marco A L Barbosa | a3759d7 | 2017-02-27 17:25:55 -0300 | [diff] [blame] | 988 | pub fn telldir(dirp: *mut ::DIR) -> ::c_long; |
Marco A L Barbosa | fab2d30 | 2017-02-27 16:41:57 -0300 | [diff] [blame] | 989 | pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) |
| 990 | -> ::c_int; |
| 991 | |
| 992 | pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; |
| 993 | |
| 994 | pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, |
Marco A L Barbosa | a3759d7 | 2017-02-27 17:25:55 -0300 | [diff] [blame] | 995 | flags: ::c_int, addr: *mut ::sockaddr, |
| 996 | addrlen: *mut ::socklen_t) -> ::ssize_t; |
Marco A L Barbosa | fab2d30 | 2017-02-27 16:41:57 -0300 | [diff] [blame] | 997 | pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; |
| 998 | pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; |
| 999 | pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; |
| 1000 | |
Marco A L Barbosa | a3759d7 | 2017-02-27 17:25:55 -0300 | [diff] [blame] | 1001 | pub fn bind(socket: ::c_int, address: *const ::sockaddr, |
| 1002 | address_len: ::socklen_t) -> ::c_int; |
Marco A L Barbosa | fab2d30 | 2017-02-27 16:41:57 -0300 | [diff] [blame] | 1003 | |
| 1004 | pub fn writev(fd: ::c_int, |
| 1005 | iov: *const ::iovec, |
| 1006 | iovcnt: ::c_int) -> ::ssize_t; |
| 1007 | pub fn readv(fd: ::c_int, |
| 1008 | iov: *const ::iovec, |
| 1009 | iovcnt: ::c_int) -> ::ssize_t; |
| 1010 | |
| 1011 | pub fn sendmsg(fd: ::c_int, |
Marco A L Barbosa | a3759d7 | 2017-02-27 17:25:55 -0300 | [diff] [blame] | 1012 | msg: *const ::msghdr, |
Marco A L Barbosa | fab2d30 | 2017-02-27 16:41:57 -0300 | [diff] [blame] | 1013 | flags: ::c_int) -> ::ssize_t; |
Marco A L Barbosa | 9a20f93 | 2017-02-27 17:54:51 -0300 | [diff] [blame] | 1014 | pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) |
| 1015 | -> ::ssize_t; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 1016 | } |
| 1017 | |
NODA, Kai | 61c23fb | 2016-04-10 22:21:55 +0800 | [diff] [blame] | 1018 | extern { |
| 1019 | pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint, |
| 1020 | flags: ::c_int) -> ::c_int; |
| 1021 | pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint, |
| 1022 | flags: ::c_int, timeout: *mut ::timespec) -> ::c_int; |
| 1023 | } |
| 1024 | |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 1025 | cfg_if! { |
Brian Anderson | 7d1d575 | 2015-11-26 23:27:45 +0000 | [diff] [blame] | 1026 | if #[cfg(any(target_env = "musl", |
Raph Levien | 517e86d | 2016-10-11 15:26:47 -0700 | [diff] [blame] | 1027 | target_os = "fuchsia", |
Brian Anderson | 7d1d575 | 2015-11-26 23:27:45 +0000 | [diff] [blame] | 1028 | target_os = "emscripten"))] { |
Alex Crichton | 7482522 | 2015-10-29 17:36:55 -0700 | [diff] [blame] | 1029 | mod musl; |
| 1030 | pub use self::musl::*; |
Wang Xuerui | 6b72990 | 2016-11-14 22:40:05 +0800 | [diff] [blame] | 1031 | } else if #[cfg(any(target_arch = "mips", |
| 1032 | target_arch = "mips64"))] { |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 1033 | mod mips; |
| 1034 | pub use self::mips::*; |
Jorge Aparicio | e7480ed | 2016-09-02 21:08:02 -0500 | [diff] [blame] | 1035 | } else if #[cfg(any(target_arch = "s390x"))] { |
| 1036 | mod s390x; |
| 1037 | pub use self::s390x::*; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 1038 | } else { |
Alex Crichton | 62a6c82 | 2015-11-09 13:58:44 -0800 | [diff] [blame] | 1039 | mod other; |
| 1040 | pub use self::other::*; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 1041 | } |
| 1042 | } |