aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / libc / src / unix / linux_like / emscripten / mod.rs
| 1 | use crate::prelude::*; |
| 2 | |
| 3 | pub type wchar_t = i32; |
| 4 | pub type dev_t = u32; |
| 5 | pub type socklen_t = u32; |
| 6 | pub type pthread_t = c_ulong; |
| 7 | pub type mode_t = u32; |
| 8 | pub type shmatt_t = c_ulong; |
| 9 | pub type mqd_t = c_int; |
| 10 | pub type msgqnum_t = c_ulong; |
| 11 | pub type msglen_t = c_ulong; |
| 12 | pub type nfds_t = c_ulong; |
| 13 | pub type nl_item = c_int; |
| 14 | pub type idtype_t = c_uint; |
| 15 | pub type loff_t = i64; |
| 16 | pub type pthread_key_t = c_uint; |
| 17 | |
| 18 | pub type clock_t = c_long; |
| 19 | pub type time_t = i64; |
| 20 | pub type suseconds_t = c_long; |
| 21 | pub type ino_t = u64; |
| 22 | pub type off_t = i64; |
| 23 | pub type blkcnt_t = i32; |
| 24 | |
| 25 | pub type blksize_t = c_long; |
| 26 | pub type fsblkcnt_t = u32; |
| 27 | pub type fsfilcnt_t = u32; |
| 28 | pub type rlim_t = u64; |
| 29 | pub type nlink_t = u32; |
| 30 | |
| 31 | pub type ino64_t = crate::ino_t; |
| 32 | pub type off64_t = off_t; |
| 33 | pub type blkcnt64_t = crate::blkcnt_t; |
| 34 | pub type rlim64_t = crate::rlim_t; |
| 35 | |
| 36 | pub type rlimit64 = crate::rlimit; |
| 37 | pub type flock64 = crate::flock; |
| 38 | pub type stat64 = crate::stat; |
| 39 | pub type statfs64 = crate::statfs; |
| 40 | pub type statvfs64 = crate::statvfs; |
| 41 | pub type dirent64 = crate::dirent; |
| 42 | |
| 43 | extern_ty! { |
| 44 | pub type fpos64_t; // FIXME(emscripten): fill this out with a struct |
| 45 | } |
| 46 | |
| 47 | s! { |
| 48 | pub struct glob_t { |
| 49 | pub gl_pathc: size_t, |
| 50 | pub gl_pathv: *mut *mut c_char, |
| 51 | pub gl_offs: size_t, |
| 52 | pub gl_flags: c_int, |
| 53 | |
| 54 | __unused1: Padding<*mut c_void>, |
| 55 | __unused2: Padding<*mut c_void>, |
| 56 | __unused3: Padding<*mut c_void>, |
| 57 | __unused4: Padding<*mut c_void>, |
| 58 | __unused5: Padding<*mut c_void>, |
| 59 | } |
| 60 | |
| 61 | pub struct passwd { |
| 62 | pub pw_name: *mut c_char, |
| 63 | pub pw_passwd: *mut c_char, |
| 64 | pub pw_uid: crate::uid_t, |
| 65 | pub pw_gid: crate::gid_t, |
| 66 | pub pw_gecos: *mut c_char, |
| 67 | pub pw_dir: *mut c_char, |
| 68 | pub pw_shell: *mut c_char, |
| 69 | } |
| 70 | |
| 71 | pub struct spwd { |
| 72 | pub sp_namp: *mut c_char, |
| 73 | pub sp_pwdp: *mut c_char, |
| 74 | pub sp_lstchg: c_long, |
| 75 | pub sp_min: c_long, |
| 76 | pub sp_max: c_long, |
| 77 | pub sp_warn: c_long, |
| 78 | pub sp_inact: c_long, |
| 79 | pub sp_expire: c_long, |
| 80 | pub sp_flag: c_ulong, |
| 81 | } |
| 82 | |
| 83 | pub struct statvfs { |
| 84 | pub f_bsize: c_ulong, |
| 85 | pub f_frsize: c_ulong, |
| 86 | pub f_blocks: crate::fsblkcnt_t, |
| 87 | pub f_bfree: crate::fsblkcnt_t, |
| 88 | pub f_bavail: crate::fsblkcnt_t, |
| 89 | pub f_files: crate::fsfilcnt_t, |
| 90 | pub f_ffree: crate::fsfilcnt_t, |
| 91 | pub f_favail: crate::fsfilcnt_t, |
| 92 | pub f_fsid: c_ulong, |
| 93 | __f_unused: Padding<c_int>, |
| 94 | pub f_flag: c_ulong, |
| 95 | pub f_namemax: c_ulong, |
| 96 | __f_spare: [c_int; 6], |
| 97 | } |
| 98 | |
| 99 | pub struct signalfd_siginfo { |
| 100 | pub ssi_signo: u32, |
| 101 | pub ssi_errno: i32, |
| 102 | pub ssi_code: i32, |
| 103 | pub ssi_pid: u32, |
| 104 | pub ssi_uid: u32, |
| 105 | pub ssi_fd: i32, |
| 106 | pub ssi_tid: u32, |
| 107 | pub ssi_band: u32, |
| 108 | pub ssi_overrun: u32, |
| 109 | pub ssi_trapno: u32, |
| 110 | pub ssi_status: i32, |
| 111 | pub ssi_int: i32, |
| 112 | pub ssi_ptr: u64, |
| 113 | pub ssi_utime: u64, |
| 114 | pub ssi_stime: u64, |
| 115 | pub ssi_addr: u64, |
| 116 | pub ssi_addr_lsb: u16, |
| 117 | _pad2: Padding<u16>, |
| 118 | pub ssi_syscall: i32, |
| 119 | pub ssi_call_addr: u64, |
| 120 | pub ssi_arch: u32, |
| 121 | _pad: Padding<[u8; 28]>, |
| 122 | } |
| 123 | |
| 124 | pub struct fsid_t { |
| 125 | __val: [c_int; 2], |
| 126 | } |
| 127 | |
| 128 | pub struct cpu_set_t { |
| 129 | bits: [u32; 32], |
| 130 | } |
| 131 | |
| 132 | // System V IPC |
| 133 | pub struct msginfo { |
| 134 | pub msgpool: c_int, |
| 135 | pub msgmap: c_int, |
| 136 | pub msgmax: c_int, |
| 137 | pub msgmnb: c_int, |
| 138 | pub msgmni: c_int, |
| 139 | pub msgssz: c_int, |
| 140 | pub msgtql: c_int, |
| 141 | pub msgseg: c_ushort, |
| 142 | } |
| 143 | |
| 144 | pub struct sembuf { |
| 145 | pub sem_num: c_ushort, |
| 146 | pub sem_op: c_short, |
| 147 | pub sem_flg: c_short, |
| 148 | } |
| 149 | |
| 150 | // FIXME(1.0): This should not implement `PartialEq` |
| 151 | #[allow(unpredictable_function_pointer_comparisons)] |
| 152 | pub struct sigaction { |
| 153 | pub sa_sigaction: crate::sighandler_t, |
| 154 | pub sa_mask: crate::sigset_t, |
| 155 | pub sa_flags: c_int, |
| 156 | pub sa_restorer: Option<extern "C" fn()>, |
| 157 | } |
| 158 | |
| 159 | pub struct ipc_perm { |
| 160 | pub __ipc_perm_key: crate::key_t, |
| 161 | pub uid: crate::uid_t, |
| 162 | pub gid: crate::gid_t, |
| 163 | pub cuid: crate::uid_t, |
| 164 | pub cgid: crate::gid_t, |
| 165 | pub mode: mode_t, |
| 166 | pub __seq: c_int, |
| 167 | __unused1: Padding<c_long>, |
| 168 | __unused2: Padding<c_long>, |
| 169 | } |
| 170 | |
| 171 | pub struct termios { |
| 172 | pub c_iflag: crate::tcflag_t, |
| 173 | pub c_oflag: crate::tcflag_t, |
| 174 | pub c_cflag: crate::tcflag_t, |
| 175 | pub c_lflag: crate::tcflag_t, |
| 176 | pub c_line: crate::cc_t, |
| 177 | pub c_cc: [crate::cc_t; crate::NCCS], |
| 178 | pub __c_ispeed: crate::speed_t, |
| 179 | pub __c_ospeed: crate::speed_t, |
| 180 | } |
| 181 | |
| 182 | pub struct flock { |
| 183 | pub l_type: c_short, |
| 184 | pub l_whence: c_short, |
| 185 | pub l_start: off_t, |
| 186 | pub l_len: off_t, |
| 187 | pub l_pid: crate::pid_t, |
| 188 | } |
| 189 | |
| 190 | pub struct pthread_attr_t { |
| 191 | // 11 pointer-width words: 44 bytes on wasm32, 88 on wasm64 (MEMORY64). |
| 192 | __size: [usize; 11], |
| 193 | } |
| 194 | |
| 195 | pub struct sigset_t { |
| 196 | __val: [c_ulong; 32], |
| 197 | } |
| 198 | |
| 199 | pub struct msghdr { |
| 200 | pub msg_name: *mut c_void, |
| 201 | pub msg_namelen: crate::socklen_t, |
| 202 | pub msg_iov: *mut crate::iovec, |
| 203 | pub msg_iovlen: c_int, |
| 204 | pub msg_control: *mut c_void, |
| 205 | pub msg_controllen: crate::socklen_t, |
| 206 | pub msg_flags: c_int, |
| 207 | } |
| 208 | |
| 209 | pub struct cmsghdr { |
| 210 | pub cmsg_len: crate::socklen_t, |
| 211 | pub cmsg_level: c_int, |
| 212 | pub cmsg_type: c_int, |
| 213 | } |
| 214 | |
| 215 | pub struct in6_pktinfo { |
| 216 | pub ipi6_addr: crate::in6_addr, |
| 217 | pub ipi6_ifindex: c_uint, |
| 218 | } |
| 219 | |
| 220 | pub struct sem_t { |
| 221 | __val: [c_int; 4], |
| 222 | } |
| 223 | pub struct stat { |
| 224 | pub st_dev: crate::dev_t, |
| 225 | #[cfg(emscripten_old_stat_abi)] |
| 226 | __st_dev_padding: Padding<c_int>, |
| 227 | #[cfg(emscripten_old_stat_abi)] |
| 228 | __st_ino_truncated: c_long, |
| 229 | pub st_mode: mode_t, |
| 230 | pub st_nlink: crate::nlink_t, |
| 231 | pub st_uid: crate::uid_t, |
| 232 | pub st_gid: crate::gid_t, |
| 233 | pub st_rdev: crate::dev_t, |
| 234 | #[cfg(emscripten_old_stat_abi)] |
| 235 | __st_rdev_padding: Padding<c_int>, |
| 236 | pub st_size: off_t, |
| 237 | pub st_blksize: crate::blksize_t, |
| 238 | pub st_blocks: crate::blkcnt_t, |
| 239 | pub st_atime: crate::time_t, |
| 240 | pub st_atime_nsec: c_long, |
| 241 | pub st_mtime: crate::time_t, |
| 242 | pub st_mtime_nsec: c_long, |
| 243 | pub st_ctime: crate::time_t, |
| 244 | pub st_ctime_nsec: c_long, |
| 245 | pub st_ino: crate::ino_t, |
| 246 | } |
| 247 | |
| 248 | pub struct stack_t { |
| 249 | pub ss_sp: *mut c_void, |
| 250 | pub ss_flags: c_int, |
| 251 | pub ss_size: size_t, |
| 252 | } |
| 253 | |
| 254 | pub struct shmid_ds { |
| 255 | pub shm_perm: crate::ipc_perm, |
| 256 | pub shm_segsz: size_t, |
| 257 | pub shm_atime: crate::time_t, |
| 258 | pub shm_dtime: crate::time_t, |
| 259 | pub shm_ctime: crate::time_t, |
| 260 | pub shm_cpid: crate::pid_t, |
| 261 | pub shm_lpid: crate::pid_t, |
| 262 | pub shm_nattch: c_ulong, |
| 263 | __pad1: Padding<c_ulong>, |
| 264 | __pad2: Padding<c_ulong>, |
| 265 | } |
| 266 | |
| 267 | pub struct msqid_ds { |
| 268 | pub msg_perm: crate::ipc_perm, |
| 269 | pub msg_stime: crate::time_t, |
| 270 | pub msg_rtime: crate::time_t, |
| 271 | pub msg_ctime: crate::time_t, |
| 272 | pub __msg_cbytes: c_ulong, |
| 273 | pub msg_qnum: crate::msgqnum_t, |
| 274 | pub msg_qbytes: crate::msglen_t, |
| 275 | pub msg_lspid: crate::pid_t, |
| 276 | pub msg_lrpid: crate::pid_t, |
| 277 | __pad1: Padding<c_ulong>, |
| 278 | __pad2: Padding<c_ulong>, |
| 279 | } |
| 280 | |
| 281 | pub struct statfs { |
| 282 | pub f_type: c_ulong, |
| 283 | pub f_bsize: c_ulong, |
| 284 | pub f_blocks: crate::fsblkcnt_t, |
| 285 | pub f_bfree: crate::fsblkcnt_t, |
| 286 | pub f_bavail: crate::fsblkcnt_t, |
| 287 | pub f_files: crate::fsfilcnt_t, |
| 288 | pub f_ffree: crate::fsfilcnt_t, |
| 289 | pub f_fsid: crate::fsid_t, |
| 290 | pub f_namelen: c_ulong, |
| 291 | pub f_frsize: c_ulong, |
| 292 | pub f_flags: c_ulong, |
| 293 | pub f_spare: [c_ulong; 4], |
| 294 | } |
| 295 | |
| 296 | pub struct siginfo_t { |
| 297 | pub si_signo: c_int, |
| 298 | pub si_errno: c_int, |
| 299 | pub si_code: c_int, |
| 300 | pub _pad: [c_int; 29], |
| 301 | _align: [usize; 0], |
| 302 | } |
| 303 | |
| 304 | pub struct arpd_request { |
| 305 | pub req: c_ushort, |
| 306 | pub ip: u32, |
| 307 | pub dev: c_ulong, |
| 308 | pub stamp: c_ulong, |
| 309 | pub updated: c_ulong, |
| 310 | pub ha: [c_uchar; crate::MAX_ADDR_LEN], |
| 311 | } |
| 312 | |
| 313 | #[repr(align(4))] |
| 314 | pub struct pthread_mutex_t { |
| 315 | size: [u8; crate::__SIZEOF_PTHREAD_MUTEX_T], |
| 316 | } |
| 317 | |
| 318 | #[repr(align(4))] |
| 319 | pub struct pthread_rwlock_t { |
| 320 | size: [u8; crate::__SIZEOF_PTHREAD_RWLOCK_T], |
| 321 | } |
| 322 | |
| 323 | #[repr(align(4))] |
| 324 | pub struct pthread_mutexattr_t { |
| 325 | size: [u8; crate::__SIZEOF_PTHREAD_MUTEXATTR_T], |
| 326 | } |
| 327 | |
| 328 | #[repr(align(4))] |
| 329 | pub struct pthread_rwlockattr_t { |
| 330 | size: [u8; crate::__SIZEOF_PTHREAD_RWLOCKATTR_T], |
| 331 | } |
| 332 | |
| 333 | #[repr(align(4))] |
| 334 | pub struct pthread_condattr_t { |
| 335 | size: [u8; crate::__SIZEOF_PTHREAD_CONDATTR_T], |
| 336 | } |
| 337 | |
| 338 | pub struct dirent { |
| 339 | pub d_ino: crate::ino_t, |
| 340 | pub d_off: off_t, |
| 341 | pub d_reclen: c_ushort, |
| 342 | pub d_type: c_uchar, |
| 343 | pub d_name: [c_char; 256], |
| 344 | } |
| 345 | |
| 346 | pub struct sysinfo { |
| 347 | pub uptime: c_ulong, |
| 348 | pub loads: [c_ulong; 3], |
| 349 | pub totalram: c_ulong, |
| 350 | pub freeram: c_ulong, |
| 351 | pub sharedram: c_ulong, |
| 352 | pub bufferram: c_ulong, |
| 353 | pub totalswap: c_ulong, |
| 354 | pub freeswap: c_ulong, |
| 355 | pub procs: c_ushort, |
| 356 | pub pad: c_ushort, |
| 357 | pub totalhigh: c_ulong, |
| 358 | pub freehigh: c_ulong, |
| 359 | pub mem_unit: c_uint, |
| 360 | pub __reserved: [c_char; 256], |
| 361 | } |
| 362 | |
| 363 | pub struct mq_attr { |
| 364 | pub mq_flags: c_long, |
| 365 | pub mq_maxmsg: c_long, |
| 366 | pub mq_msgsize: c_long, |
| 367 | pub mq_curmsgs: c_long, |
| 368 | pad: Padding<[c_long; 4]>, |
| 369 | } |
| 370 | |
| 371 | #[cfg_attr(target_pointer_width = "32", repr(align(4)))] |
| 372 | #[cfg_attr(target_pointer_width = "64", repr(align(8)))] |
| 373 | pub struct pthread_cond_t { |
| 374 | size: [u8; crate::__SIZEOF_PTHREAD_COND_T], |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | s_no_extra_traits! { |
| 379 | #[repr(align(8))] |
| 380 | pub struct max_align_t { |
| 381 | priv_: [f64; 3], |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | pub const MADV_SOFT_OFFLINE: c_int = 101; |
| 386 | pub const MS_NOUSER: c_ulong = 0x80000000; |
| 387 | pub const MS_RMT_MASK: c_ulong = 0x02800051; |
| 388 | |
| 389 | pub const ABDAY_1: crate::nl_item = 0x20000; |
| 390 | pub const ABDAY_2: crate::nl_item = 0x20001; |
| 391 | pub const ABDAY_3: crate::nl_item = 0x20002; |
| 392 | pub const ABDAY_4: crate::nl_item = 0x20003; |
| 393 | pub const ABDAY_5: crate::nl_item = 0x20004; |
| 394 | pub const ABDAY_6: crate::nl_item = 0x20005; |
| 395 | pub const ABDAY_7: crate::nl_item = 0x20006; |
| 396 | |
| 397 | pub const DAY_1: crate::nl_item = 0x20007; |
| 398 | pub const DAY_2: crate::nl_item = 0x20008; |
| 399 | pub const DAY_3: crate::nl_item = 0x20009; |
| 400 | pub const DAY_4: crate::nl_item = 0x2000A; |
| 401 | pub const DAY_5: crate::nl_item = 0x2000B; |
| 402 | pub const DAY_6: crate::nl_item = 0x2000C; |
| 403 | pub const DAY_7: crate::nl_item = 0x2000D; |
| 404 | |
| 405 | pub const ABMON_1: crate::nl_item = 0x2000E; |
| 406 | pub const ABMON_2: crate::nl_item = 0x2000F; |
| 407 | pub const ABMON_3: crate::nl_item = 0x20010; |
| 408 | pub const ABMON_4: crate::nl_item = 0x20011; |
| 409 | pub const ABMON_5: crate::nl_item = 0x20012; |
| 410 | pub const ABMON_6: crate::nl_item = 0x20013; |
| 411 | pub const ABMON_7: crate::nl_item = 0x20014; |
| 412 | pub const ABMON_8: crate::nl_item = 0x20015; |
| 413 | pub const ABMON_9: crate::nl_item = 0x20016; |
| 414 | pub const ABMON_10: crate::nl_item = 0x20017; |
| 415 | pub const ABMON_11: crate::nl_item = 0x20018; |
| 416 | pub const ABMON_12: crate::nl_item = 0x20019; |
| 417 | |
| 418 | pub const MON_1: crate::nl_item = 0x2001A; |
| 419 | pub const MON_2: crate::nl_item = 0x2001B; |
| 420 | pub const MON_3: crate::nl_item = 0x2001C; |
| 421 | pub const MON_4: crate::nl_item = 0x2001D; |
| 422 | pub const MON_5: crate::nl_item = 0x2001E; |
| 423 | pub const MON_6: crate::nl_item = 0x2001F; |
| 424 | pub const MON_7: crate::nl_item = 0x20020; |
| 425 | pub const MON_8: crate::nl_item = 0x20021; |
| 426 | pub const MON_9: crate::nl_item = 0x20022; |
| 427 | pub const MON_10: crate::nl_item = 0x20023; |
| 428 | pub const MON_11: crate::nl_item = 0x20024; |
| 429 | pub const MON_12: crate::nl_item = 0x20025; |
| 430 | |
| 431 | pub const AM_STR: crate::nl_item = 0x20026; |
| 432 | pub const PM_STR: crate::nl_item = 0x20027; |
| 433 | |
| 434 | pub const D_T_FMT: crate::nl_item = 0x20028; |
| 435 | pub const D_FMT: crate::nl_item = 0x20029; |
| 436 | pub const T_FMT: crate::nl_item = 0x2002A; |
| 437 | pub const T_FMT_AMPM: crate::nl_item = 0x2002B; |
| 438 | |
| 439 | pub const ERA: crate::nl_item = 0x2002C; |
| 440 | pub const ERA_D_FMT: crate::nl_item = 0x2002E; |
| 441 | pub const ALT_DIGITS: crate::nl_item = 0x2002F; |
| 442 | pub const ERA_D_T_FMT: crate::nl_item = 0x20030; |
| 443 | pub const ERA_T_FMT: crate::nl_item = 0x20031; |
| 444 | |
| 445 | pub const CODESET: crate::nl_item = 14; |
| 446 | |
| 447 | pub const CRNCYSTR: crate::nl_item = 0x4000F; |
| 448 | |
| 449 | pub const RUSAGE_THREAD: c_int = 1; |
| 450 | pub const RUSAGE_CHILDREN: c_int = -1; |
| 451 | |
| 452 | pub const RADIXCHAR: crate::nl_item = 0x10000; |
| 453 | pub const THOUSEP: crate::nl_item = 0x10001; |
| 454 | |
| 455 | pub const YESEXPR: crate::nl_item = 0x50000; |
| 456 | pub const NOEXPR: crate::nl_item = 0x50001; |
| 457 | pub const YESSTR: crate::nl_item = 0x50002; |
| 458 | pub const NOSTR: crate::nl_item = 0x50003; |
| 459 | |
| 460 | pub const FILENAME_MAX: c_uint = 4096; |
| 461 | pub const L_tmpnam: c_uint = 20; |
| 462 | pub const _PC_LINK_MAX: c_int = 0; |
| 463 | pub const _PC_MAX_CANON: c_int = 1; |
| 464 | pub const _PC_MAX_INPUT: c_int = 2; |
| 465 | pub const _PC_NAME_MAX: c_int = 3; |
| 466 | pub const _PC_PATH_MAX: c_int = 4; |
| 467 | pub const _PC_PIPE_BUF: c_int = 5; |
| 468 | pub const _PC_CHOWN_RESTRICTED: c_int = 6; |
| 469 | pub const _PC_NO_TRUNC: c_int = 7; |
| 470 | pub const _PC_VDISABLE: c_int = 8; |
| 471 | pub const _PC_SYNC_IO: c_int = 9; |
| 472 | pub const _PC_ASYNC_IO: c_int = 10; |
| 473 | pub const _PC_PRIO_IO: c_int = 11; |
| 474 | pub const _PC_SOCK_MAXBUF: c_int = 12; |
| 475 | pub const _PC_FILESIZEBITS: c_int = 13; |
| 476 | pub const _PC_REC_INCR_XFER_SIZE: c_int = 14; |
| 477 | pub const _PC_REC_MAX_XFER_SIZE: c_int = 15; |
| 478 | pub const _PC_REC_MIN_XFER_SIZE: c_int = 16; |
| 479 | pub const _PC_REC_XFER_ALIGN: c_int = 17; |
| 480 | pub const _PC_ALLOC_SIZE_MIN: c_int = 18; |
| 481 | pub const _PC_SYMLINK_MAX: c_int = 19; |
| 482 | pub const _PC_2_SYMLINKS: c_int = 20; |
| 483 | |
| 484 | pub const _SC_ARG_MAX: c_int = 0; |
| 485 | pub const _SC_CHILD_MAX: c_int = 1; |
| 486 | pub const _SC_CLK_TCK: c_int = 2; |
| 487 | pub const _SC_NGROUPS_MAX: c_int = 3; |
| 488 | pub const _SC_OPEN_MAX: c_int = 4; |
| 489 | pub const _SC_STREAM_MAX: c_int = 5; |
| 490 | pub const _SC_TZNAME_MAX: c_int = 6; |
| 491 | pub const _SC_JOB_CONTROL: c_int = 7; |
| 492 | pub const _SC_SAVED_IDS: c_int = 8; |
| 493 | pub const _SC_REALTIME_SIGNALS: c_int = 9; |
| 494 | pub const _SC_PRIORITY_SCHEDULING: c_int = 10; |
| 495 | pub const _SC_TIMERS: c_int = 11; |
| 496 | pub const _SC_ASYNCHRONOUS_IO: c_int = 12; |
| 497 | pub const _SC_PRIORITIZED_IO: c_int = 13; |
| 498 | pub const _SC_SYNCHRONIZED_IO: c_int = 14; |
| 499 | pub const _SC_FSYNC: c_int = 15; |
| 500 | pub const _SC_MAPPED_FILES: c_int = 16; |
| 501 | pub const _SC_MEMLOCK: c_int = 17; |
| 502 | pub const _SC_MEMLOCK_RANGE: c_int = 18; |
| 503 | pub const _SC_MEMORY_PROTECTION: c_int = 19; |
| 504 | pub const _SC_MESSAGE_PASSING: c_int = 20; |
| 505 | pub const _SC_SEMAPHORES: c_int = 21; |
| 506 | pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 22; |
| 507 | pub const _SC_AIO_LISTIO_MAX: c_int = 23; |
| 508 | pub const _SC_AIO_MAX: c_int = 24; |
| 509 | pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 25; |
| 510 | pub const _SC_DELAYTIMER_MAX: c_int = 26; |
| 511 | pub const _SC_MQ_OPEN_MAX: c_int = 27; |
| 512 | pub const _SC_MQ_PRIO_MAX: c_int = 28; |
| 513 | pub const _SC_VERSION: c_int = 29; |
| 514 | pub const _SC_PAGESIZE: c_int = 30; |
| 515 | pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE; |
| 516 | pub const _SC_RTSIG_MAX: c_int = 31; |
| 517 | pub const _SC_SEM_NSEMS_MAX: c_int = 32; |
| 518 | pub const _SC_SEM_VALUE_MAX: c_int = 33; |
| 519 | pub const _SC_SIGQUEUE_MAX: c_int = 34; |
| 520 | pub const _SC_TIMER_MAX: c_int = 35; |
| 521 | pub const _SC_BC_BASE_MAX: c_int = 36; |
| 522 | pub const _SC_BC_DIM_MAX: c_int = 37; |
| 523 | pub const _SC_BC_SCALE_MAX: c_int = 38; |
| 524 | pub const _SC_BC_STRING_MAX: c_int = 39; |
| 525 | pub const _SC_COLL_WEIGHTS_MAX: c_int = 40; |
| 526 | pub const _SC_EXPR_NEST_MAX: c_int = 42; |
| 527 | pub const _SC_LINE_MAX: c_int = 43; |
| 528 | pub const _SC_RE_DUP_MAX: c_int = 44; |
| 529 | pub const _SC_2_VERSION: c_int = 46; |
| 530 | pub const _SC_2_C_BIND: c_int = 47; |
| 531 | pub const _SC_2_C_DEV: c_int = 48; |
| 532 | pub const _SC_2_FORT_DEV: c_int = 49; |
| 533 | pub const _SC_2_FORT_RUN: c_int = 50; |
| 534 | pub const _SC_2_SW_DEV: c_int = 51; |
| 535 | pub const _SC_2_LOCALEDEF: c_int = 52; |
| 536 | pub const _SC_UIO_MAXIOV: c_int = 60; |
| 537 | pub const _SC_IOV_MAX: c_int = 60; |
| 538 | pub const _SC_THREADS: c_int = 67; |
| 539 | pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 68; |
| 540 | pub const _SC_GETGR_R_SIZE_MAX: c_int = 69; |
| 541 | pub const _SC_GETPW_R_SIZE_MAX: c_int = 70; |
| 542 | pub const _SC_LOGIN_NAME_MAX: c_int = 71; |
| 543 | pub const _SC_TTY_NAME_MAX: c_int = 72; |
| 544 | pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 73; |
| 545 | pub const _SC_THREAD_KEYS_MAX: c_int = 74; |
| 546 | pub const _SC_THREAD_STACK_MIN: c_int = 75; |
| 547 | pub const _SC_THREAD_THREADS_MAX: c_int = 76; |
| 548 | pub const _SC_THREAD_ATTR_STACKADDR: c_int = 77; |
| 549 | pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 78; |
| 550 | pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 79; |
| 551 | pub const _SC_THREAD_PRIO_INHERIT: c_int = 80; |
| 552 | pub const _SC_THREAD_PRIO_PROTECT: c_int = 81; |
| 553 | pub const _SC_THREAD_PROCESS_SHARED: c_int = 82; |
| 554 | pub const _SC_NPROCESSORS_CONF: c_int = 83; |
| 555 | pub const _SC_NPROCESSORS_ONLN: c_int = 84; |
| 556 | pub const _SC_PHYS_PAGES: c_int = 85; |
| 557 | pub const _SC_AVPHYS_PAGES: c_int = 86; |
| 558 | pub const _SC_ATEXIT_MAX: c_int = 87; |
| 559 | pub const _SC_PASS_MAX: c_int = 88; |
| 560 | pub const _SC_XOPEN_VERSION: c_int = 89; |
| 561 | pub const _SC_XOPEN_XCU_VERSION: c_int = 90; |
| 562 | pub const _SC_XOPEN_UNIX: c_int = 91; |
| 563 | pub const _SC_XOPEN_CRYPT: c_int = 92; |
| 564 | pub const _SC_XOPEN_ENH_I18N: c_int = 93; |
| 565 | pub const _SC_XOPEN_SHM: c_int = 94; |
| 566 | pub const _SC_2_CHAR_TERM: c_int = 95; |
| 567 | pub const _SC_2_UPE: c_int = 97; |
| 568 | pub const _SC_XOPEN_XPG2: c_int = 98; |
| 569 | pub const _SC_XOPEN_XPG3: c_int = 99; |
| 570 | pub const _SC_XOPEN_XPG4: c_int = 100; |
| 571 | pub const _SC_NZERO: c_int = 109; |
| 572 | pub const _SC_XBS5_ILP32_OFF32: c_int = 125; |
| 573 | pub const _SC_XBS5_ILP32_OFFBIG: c_int = 126; |
| 574 | pub const _SC_XBS5_LP64_OFF64: c_int = 127; |
| 575 | pub const _SC_XBS5_LPBIG_OFFBIG: c_int = 128; |
| 576 | pub const _SC_XOPEN_LEGACY: c_int = 129; |
| 577 | pub const _SC_XOPEN_REALTIME: c_int = 130; |
| 578 | pub const _SC_XOPEN_REALTIME_THREADS: c_int = 131; |
| 579 | pub const _SC_ADVISORY_INFO: c_int = 132; |
| 580 | pub const _SC_BARRIERS: c_int = 133; |
| 581 | pub const _SC_CLOCK_SELECTION: c_int = 137; |
| 582 | pub const _SC_CPUTIME: c_int = 138; |
| 583 | pub const _SC_THREAD_CPUTIME: c_int = 139; |
| 584 | pub const _SC_MONOTONIC_CLOCK: c_int = 149; |
| 585 | pub const _SC_READER_WRITER_LOCKS: c_int = 153; |
| 586 | pub const _SC_SPIN_LOCKS: c_int = 154; |
| 587 | pub const _SC_REGEXP: c_int = 155; |
| 588 | pub const _SC_SHELL: c_int = 157; |
| 589 | pub const _SC_SPAWN: c_int = 159; |
| 590 | pub const _SC_SPORADIC_SERVER: c_int = 160; |
| 591 | pub const _SC_THREAD_SPORADIC_SERVER: c_int = 161; |
| 592 | pub const _SC_TIMEOUTS: c_int = 164; |
| 593 | pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 165; |
| 594 | pub const _SC_2_PBS: c_int = 168; |
| 595 | pub const _SC_2_PBS_ACCOUNTING: c_int = 169; |
| 596 | pub const _SC_2_PBS_LOCATE: c_int = 170; |
| 597 | pub const _SC_2_PBS_MESSAGE: c_int = 171; |
| 598 | pub const _SC_2_PBS_TRACK: c_int = 172; |
| 599 | pub const _SC_SYMLOOP_MAX: c_int = 173; |
| 600 | pub const _SC_STREAMS: c_int = 174; |
| 601 | pub const _SC_2_PBS_CHECKPOINT: c_int = 175; |
| 602 | pub const _SC_V6_ILP32_OFF32: c_int = 176; |
| 603 | pub const _SC_V6_ILP32_OFFBIG: c_int = 177; |
| 604 | pub const _SC_V6_LP64_OFF64: c_int = 178; |
| 605 | pub const _SC_V6_LPBIG_OFFBIG: c_int = 179; |
| 606 | pub const _SC_HOST_NAME_MAX: c_int = 180; |
| 607 | pub const _SC_TRACE: c_int = 181; |
| 608 | pub const _SC_TRACE_EVENT_FILTER: c_int = 182; |
| 609 | pub const _SC_TRACE_INHERIT: c_int = 183; |
| 610 | pub const _SC_TRACE_LOG: c_int = 184; |
| 611 | pub const _SC_IPV6: c_int = 235; |
| 612 | pub const _SC_RAW_SOCKETS: c_int = 236; |
| 613 | pub const _SC_V7_ILP32_OFF32: c_int = 237; |
| 614 | pub const _SC_V7_ILP32_OFFBIG: c_int = 238; |
| 615 | pub const _SC_V7_LP64_OFF64: c_int = 239; |
| 616 | pub const _SC_V7_LPBIG_OFFBIG: c_int = 240; |
| 617 | pub const _SC_SS_REPL_MAX: c_int = 241; |
| 618 | pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 242; |
| 619 | pub const _SC_TRACE_NAME_MAX: c_int = 243; |
| 620 | pub const _SC_TRACE_SYS_MAX: c_int = 244; |
| 621 | pub const _SC_TRACE_USER_EVENT_MAX: c_int = 245; |
| 622 | pub const _SC_XOPEN_STREAMS: c_int = 246; |
| 623 | pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 247; |
| 624 | pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 248; |
| 625 | |
| 626 | pub const RLIM_SAVED_MAX: crate::rlim_t = RLIM_INFINITY; |
| 627 | pub const RLIM_SAVED_CUR: crate::rlim_t = RLIM_INFINITY; |
| 628 | |
| 629 | pub const GLOB_ERR: c_int = 1 << 0; |
| 630 | pub const GLOB_MARK: c_int = 1 << 1; |
| 631 | pub const GLOB_NOSORT: c_int = 1 << 2; |
| 632 | pub const GLOB_DOOFFS: c_int = 1 << 3; |
| 633 | pub const GLOB_NOCHECK: c_int = 1 << 4; |
| 634 | pub const GLOB_APPEND: c_int = 1 << 5; |
| 635 | pub const GLOB_NOESCAPE: c_int = 1 << 6; |
| 636 | |
| 637 | pub const GLOB_NOSPACE: c_int = 1; |
| 638 | pub const GLOB_ABORTED: c_int = 2; |
| 639 | pub const GLOB_NOMATCH: c_int = 3; |
| 640 | |
| 641 | pub const POSIX_MADV_NORMAL: c_int = 0; |
| 642 | pub const POSIX_MADV_RANDOM: c_int = 1; |
| 643 | pub const POSIX_MADV_SEQUENTIAL: c_int = 2; |
| 644 | pub const POSIX_MADV_WILLNEED: c_int = 3; |
| 645 | |
| 646 | pub const AT_EACCESS: c_int = 0x200; |
| 647 | |
| 648 | pub const S_IEXEC: mode_t = 0o0100; |
| 649 | pub const S_IWRITE: mode_t = 0o0200; |
| 650 | pub const S_IREAD: mode_t = 0o0400; |
| 651 | |
| 652 | pub const F_LOCK: c_int = 1; |
| 653 | pub const F_TEST: c_int = 3; |
| 654 | pub const F_TLOCK: c_int = 2; |
| 655 | pub const F_ULOCK: c_int = 0; |
| 656 | |
| 657 | pub const ST_RDONLY: c_ulong = 1; |
| 658 | pub const ST_NOSUID: c_ulong = 2; |
| 659 | pub const ST_NODEV: c_ulong = 4; |
| 660 | pub const ST_NOEXEC: c_ulong = 8; |
| 661 | pub const ST_SYNCHRONOUS: c_ulong = 16; |
| 662 | pub const ST_MANDLOCK: c_ulong = 64; |
| 663 | pub const ST_WRITE: c_ulong = 128; |
| 664 | pub const ST_APPEND: c_ulong = 256; |
| 665 | pub const ST_IMMUTABLE: c_ulong = 512; |
| 666 | pub const ST_NOATIME: c_ulong = 1024; |
| 667 | pub const ST_NODIRATIME: c_ulong = 2048; |
| 668 | |
| 669 | pub const RTLD_NEXT: *mut c_void = -1i64 as *mut c_void; |
| 670 | pub const RTLD_DEFAULT: *mut c_void = ptr::null_mut(); |
| 671 | pub const RTLD_NODELETE: c_int = 0x1000; |
| 672 | pub const RTLD_NOW: c_int = 0x2; |
| 673 | |
| 674 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { |
| 675 | size: [0; __SIZEOF_PTHREAD_MUTEX_T], |
| 676 | }; |
| 677 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { |
| 678 | size: [0; __SIZEOF_PTHREAD_COND_T], |
| 679 | }; |
| 680 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { |
| 681 | size: [0; __SIZEOF_PTHREAD_RWLOCK_T], |
| 682 | }; |
| 683 | |
| 684 | pub const PTHREAD_MUTEX_NORMAL: c_int = 0; |
| 685 | pub const PTHREAD_MUTEX_RECURSIVE: c_int = 1; |
| 686 | pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 2; |
| 687 | pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL; |
| 688 | pub const PTHREAD_PROCESS_PRIVATE: c_int = 0; |
| 689 | pub const PTHREAD_PROCESS_SHARED: c_int = 1; |
| 690 | pub const __SIZEOF_PTHREAD_COND_T: usize = 48; |
| 691 | |
| 692 | pub const SCHED_OTHER: c_int = 0; |
| 693 | pub const SCHED_FIFO: c_int = 1; |
| 694 | pub const SCHED_RR: c_int = 2; |
| 695 | pub const SCHED_BATCH: c_int = 3; |
| 696 | pub const SCHED_IDLE: c_int = 5; |
| 697 | |
| 698 | pub const AF_IB: c_int = 27; |
| 699 | pub const AF_MPLS: c_int = 28; |
| 700 | pub const AF_NFC: c_int = 39; |
| 701 | pub const AF_VSOCK: c_int = 40; |
| 702 | pub const PF_IB: c_int = AF_IB; |
| 703 | pub const PF_MPLS: c_int = AF_MPLS; |
| 704 | pub const PF_NFC: c_int = AF_NFC; |
| 705 | pub const PF_VSOCK: c_int = AF_VSOCK; |
| 706 | |
| 707 | // System V IPC |
| 708 | pub const IPC_PRIVATE: crate::key_t = 0; |
| 709 | |
| 710 | pub const IPC_CREAT: c_int = 0o1000; |
| 711 | pub const IPC_EXCL: c_int = 0o2000; |
| 712 | pub const IPC_NOWAIT: c_int = 0o4000; |
| 713 | |
| 714 | pub const IPC_RMID: c_int = 0; |
| 715 | pub const IPC_SET: c_int = 1; |
| 716 | pub const IPC_STAT: c_int = 2; |
| 717 | pub const IPC_INFO: c_int = 3; |
| 718 | pub const MSG_STAT: c_int = 11; |
| 719 | pub const MSG_INFO: c_int = 12; |
| 720 | |
| 721 | pub const MSG_NOERROR: c_int = 0o10000; |
| 722 | pub const MSG_EXCEPT: c_int = 0o20000; |
| 723 | |
| 724 | pub const SHM_R: c_int = 0o400; |
| 725 | pub const SHM_W: c_int = 0o200; |
| 726 | |
| 727 | pub const SHM_RDONLY: c_int = 0o10000; |
| 728 | pub const SHM_RND: c_int = 0o20000; |
| 729 | pub const SHM_REMAP: c_int = 0o40000; |
| 730 | pub const SHM_EXEC: c_int = 0o100000; |
| 731 | |
| 732 | pub const SHM_LOCK: c_int = 11; |
| 733 | pub const SHM_UNLOCK: c_int = 12; |
| 734 | |
| 735 | pub const SHM_HUGETLB: c_int = 0o4000; |
| 736 | pub const SHM_NORESERVE: c_int = 0o10000; |
| 737 | |
| 738 | pub const LOG_NFACILITIES: c_int = 24; |
| 739 | |
| 740 | pub const SEM_FAILED: *mut crate::sem_t = ptr::null_mut(); |
| 741 | |
| 742 | pub const AI_PASSIVE: c_int = 0x0001; |
| 743 | pub const AI_CANONNAME: c_int = 0x0002; |
| 744 | pub const AI_NUMERICHOST: c_int = 0x0004; |
| 745 | pub const AI_V4MAPPED: c_int = 0x0008; |
| 746 | pub const AI_ALL: c_int = 0x0010; |
| 747 | pub const AI_ADDRCONFIG: c_int = 0x0020; |
| 748 | |
| 749 | pub const AI_NUMERICSERV: c_int = 0x0400; |
| 750 | |
| 751 | pub const EAI_BADFLAGS: c_int = -1; |
| 752 | pub const EAI_NONAME: c_int = -2; |
| 753 | pub const EAI_AGAIN: c_int = -3; |
| 754 | pub const EAI_FAIL: c_int = -4; |
| 755 | pub const EAI_FAMILY: c_int = -6; |
| 756 | pub const EAI_SOCKTYPE: c_int = -7; |
| 757 | pub const EAI_SERVICE: c_int = -8; |
| 758 | pub const EAI_MEMORY: c_int = -10; |
| 759 | pub const EAI_OVERFLOW: c_int = -12; |
| 760 | |
| 761 | pub const NI_NUMERICHOST: c_int = 1; |
| 762 | pub const NI_NUMERICSERV: c_int = 2; |
| 763 | pub const NI_NOFQDN: c_int = 4; |
| 764 | pub const NI_NAMEREQD: c_int = 8; |
| 765 | pub const NI_DGRAM: c_int = 16; |
| 766 | |
| 767 | pub const SYNC_FILE_RANGE_WAIT_BEFORE: c_uint = 1; |
| 768 | pub const SYNC_FILE_RANGE_WRITE: c_uint = 2; |
| 769 | pub const SYNC_FILE_RANGE_WAIT_AFTER: c_uint = 4; |
| 770 | |
| 771 | pub const EAI_SYSTEM: c_int = -11; |
| 772 | |
| 773 | pub const MREMAP_MAYMOVE: c_int = 1; |
| 774 | pub const MREMAP_FIXED: c_int = 2; |
| 775 | |
| 776 | pub const ITIMER_REAL: c_int = 0; |
| 777 | pub const ITIMER_VIRTUAL: c_int = 1; |
| 778 | pub const ITIMER_PROF: c_int = 2; |
| 779 | |
| 780 | pub const _POSIX_VDISABLE: crate::cc_t = 0; |
| 781 | |
| 782 | pub const FALLOC_FL_KEEP_SIZE: c_int = 0x01; |
| 783 | pub const FALLOC_FL_PUNCH_HOLE: c_int = 0x02; |
| 784 | |
| 785 | pub const NCCS: usize = 32; |
| 786 | |
| 787 | pub const O_TRUNC: c_int = 512; |
| 788 | pub const O_NOATIME: c_int = 0o1000000; |
| 789 | pub const O_CLOEXEC: c_int = 0x80000; |
| 790 | |
| 791 | // Defined as wasi value. |
| 792 | pub const EPERM: c_int = 63; |
| 793 | pub const ENOENT: c_int = 44; |
| 794 | pub const ESRCH: c_int = 71; |
| 795 | pub const EINTR: c_int = 27; |
| 796 | pub const EIO: c_int = 29; |
| 797 | pub const ENXIO: c_int = 60; |
| 798 | pub const E2BIG: c_int = 1; |
| 799 | pub const ENOEXEC: c_int = 45; |
| 800 | pub const EBADF: c_int = 8; |
| 801 | pub const ECHILD: c_int = 12; |
| 802 | pub const EAGAIN: c_int = 6; |
| 803 | pub const ENOMEM: c_int = 48; |
| 804 | pub const EACCES: c_int = 2; |
| 805 | pub const EFAULT: c_int = 21; |
| 806 | pub const ENOTBLK: c_int = 105; |
| 807 | pub const EBUSY: c_int = 10; |
| 808 | pub const EEXIST: c_int = 20; |
| 809 | pub const EXDEV: c_int = 75; |
| 810 | pub const ENODEV: c_int = 43; |
| 811 | pub const ENOTDIR: c_int = 54; |
| 812 | pub const EISDIR: c_int = 31; |
| 813 | pub const EINVAL: c_int = 28; |
| 814 | pub const ENFILE: c_int = 41; |
| 815 | pub const EMFILE: c_int = 33; |
| 816 | pub const ENOTTY: c_int = 59; |
| 817 | pub const ETXTBSY: c_int = 74; |
| 818 | pub const EFBIG: c_int = 22; |
| 819 | pub const ENOSPC: c_int = 51; |
| 820 | pub const ESPIPE: c_int = 70; |
| 821 | pub const EROFS: c_int = 69; |
| 822 | pub const EMLINK: c_int = 34; |
| 823 | pub const EPIPE: c_int = 64; |
| 824 | pub const EDOM: c_int = 18; |
| 825 | pub const ERANGE: c_int = 68; |
| 826 | pub const EWOULDBLOCK: c_int = EAGAIN; |
| 827 | pub const ENOLINK: c_int = 47; |
| 828 | pub const EPROTO: c_int = 65; |
| 829 | pub const EDEADLK: c_int = 16; |
| 830 | pub const EDEADLOCK: c_int = EDEADLK; |
| 831 | pub const ENAMETOOLONG: c_int = 37; |
| 832 | pub const ENOLCK: c_int = 46; |
| 833 | pub const ENOSYS: c_int = 52; |
| 834 | pub const ENOTEMPTY: c_int = 55; |
| 835 | pub const ELOOP: c_int = 32; |
| 836 | pub const ENOMSG: c_int = 49; |
| 837 | pub const EIDRM: c_int = 24; |
| 838 | pub const EMULTIHOP: c_int = 36; |
| 839 | pub const EBADMSG: c_int = 9; |
| 840 | pub const EOVERFLOW: c_int = 61; |
| 841 | pub const EILSEQ: c_int = 25; |
| 842 | pub const ENOTSOCK: c_int = 57; |
| 843 | pub const EDESTADDRREQ: c_int = 17; |
| 844 | pub const EMSGSIZE: c_int = 35; |
| 845 | pub const EPROTOTYPE: c_int = 67; |
| 846 | pub const ENOPROTOOPT: c_int = 50; |
| 847 | pub const EPROTONOSUPPORT: c_int = 66; |
| 848 | pub const EAFNOSUPPORT: c_int = 5; |
| 849 | pub const EADDRINUSE: c_int = 3; |
| 850 | pub const EADDRNOTAVAIL: c_int = 4; |
| 851 | pub const ENETDOWN: c_int = 38; |
| 852 | pub const ENETUNREACH: c_int = 40; |
| 853 | pub const ENETRESET: c_int = 39; |
| 854 | pub const ECONNABORTED: c_int = 13; |
| 855 | pub const ECONNRESET: c_int = 15; |
| 856 | pub const ENOBUFS: c_int = 42; |
| 857 | pub const EISCONN: c_int = 30; |
| 858 | pub const ENOTCONN: c_int = 53; |
| 859 | pub const ETIMEDOUT: c_int = 73; |
| 860 | pub const ECONNREFUSED: c_int = 14; |
| 861 | pub const EHOSTUNREACH: c_int = 23; |
| 862 | pub const EALREADY: c_int = 7; |
| 863 | pub const EINPROGRESS: c_int = 26; |
| 864 | pub const ESTALE: c_int = 72; |
| 865 | pub const EDQUOT: c_int = 19; |
| 866 | pub const ECANCELED: c_int = 11; |
| 867 | pub const EOWNERDEAD: c_int = 62; |
| 868 | pub const ENOTRECOVERABLE: c_int = 56; |
| 869 | |
| 870 | pub const ENOSTR: c_int = 100; |
| 871 | pub const EBFONT: c_int = 101; |
| 872 | pub const EBADSLT: c_int = 102; |
| 873 | pub const EBADRQC: c_int = 103; |
| 874 | pub const ENOANO: c_int = 104; |
| 875 | pub const ECHRNG: c_int = 106; |
| 876 | pub const EL3HLT: c_int = 107; |
| 877 | pub const EL3RST: c_int = 108; |
| 878 | pub const ELNRNG: c_int = 109; |
| 879 | pub const EUNATCH: c_int = 110; |
| 880 | pub const ENOCSI: c_int = 111; |
| 881 | pub const EL2HLT: c_int = 112; |
| 882 | pub const EBADE: c_int = 113; |
| 883 | pub const EBADR: c_int = 114; |
| 884 | pub const EXFULL: c_int = 115; |
| 885 | pub const ENODATA: c_int = 116; |
| 886 | pub const ETIME: c_int = 117; |
| 887 | pub const ENOSR: c_int = 118; |
| 888 | pub const ENONET: c_int = 119; |
| 889 | pub const ENOPKG: c_int = 120; |
| 890 | pub const EREMOTE: c_int = 121; |
| 891 | pub const EADV: c_int = 122; |
| 892 | pub const ESRMNT: c_int = 123; |
| 893 | pub const ECOMM: c_int = 124; |
| 894 | pub const EDOTDOT: c_int = 125; |
| 895 | pub const ENOTUNIQ: c_int = 126; |
| 896 | pub const EBADFD: c_int = 127; |
| 897 | pub const EREMCHG: c_int = 128; |
| 898 | pub const ELIBACC: c_int = 129; |
| 899 | pub const ELIBBAD: c_int = 130; |
| 900 | pub const ELIBSCN: c_int = 131; |
| 901 | pub const ELIBMAX: c_int = 132; |
| 902 | pub const ELIBEXEC: c_int = 133; |
| 903 | pub const ERESTART: c_int = 134; |
| 904 | pub const ESTRPIPE: c_int = 135; |
| 905 | pub const EUSERS: c_int = 136; |
| 906 | pub const ESOCKTNOSUPPORT: c_int = 137; |
| 907 | pub const EOPNOTSUPP: c_int = 138; |
| 908 | pub const ENOTSUP: c_int = EOPNOTSUPP; |
| 909 | pub const EPFNOSUPPORT: c_int = 139; |
| 910 | pub const ESHUTDOWN: c_int = 140; |
| 911 | pub const ETOOMANYREFS: c_int = 141; |
| 912 | pub const EHOSTDOWN: c_int = 142; |
| 913 | pub const EUCLEAN: c_int = 143; |
| 914 | pub const ENOTNAM: c_int = 144; |
| 915 | pub const ENAVAIL: c_int = 145; |
| 916 | pub const EISNAM: c_int = 146; |
| 917 | pub const EREMOTEIO: c_int = 147; |
| 918 | pub const ENOMEDIUM: c_int = 148; |
| 919 | pub const EMEDIUMTYPE: c_int = 149; |
| 920 | pub const ENOKEY: c_int = 150; |
| 921 | pub const EKEYEXPIRED: c_int = 151; |
| 922 | pub const EKEYREVOKED: c_int = 152; |
| 923 | pub const EKEYREJECTED: c_int = 153; |
| 924 | pub const ERFKILL: c_int = 154; |
| 925 | pub const EHWPOISON: c_int = 155; |
| 926 | pub const EL2NSYNC: c_int = 156; |
| 927 | |
| 928 | pub const SA_NODEFER: c_int = 0x40000000; |
| 929 | pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); |
| 930 | pub const SA_RESTART: c_int = 0x10000000; |
| 931 | pub const SA_NOCLDSTOP: c_int = 0x00000001; |
| 932 | |
| 933 | pub const BUFSIZ: c_uint = 1024; |
| 934 | pub const TMP_MAX: c_uint = 10000; |
| 935 | pub const FOPEN_MAX: c_uint = 1000; |
| 936 | pub const O_PATH: c_int = 0o10000000; |
| 937 | pub const O_EXEC: c_int = 0o10000000; |
| 938 | pub const O_SEARCH: c_int = 0o10000000; |
| 939 | pub const O_ACCMODE: c_int = 0o10000003; |
| 940 | pub const O_NDELAY: c_int = O_NONBLOCK; |
| 941 | pub const NI_MAXHOST: crate::socklen_t = 255; |
| 942 | pub const PTHREAD_STACK_MIN: size_t = 2048; |
| 943 | pub const POSIX_FADV_DONTNEED: c_int = 4; |
| 944 | pub const POSIX_FADV_NOREUSE: c_int = 5; |
| 945 | |
| 946 | pub const POSIX_MADV_DONTNEED: c_int = 4; |
| 947 | |
| 948 | pub const RLIM_INFINITY: crate::rlim_t = !0; |
| 949 | #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] |
| 950 | pub const RLIMIT_NLIMITS: c_int = 16; |
| 951 | #[allow(deprecated)] |
| 952 | #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] |
| 953 | pub const RLIM_NLIMITS: c_int = RLIMIT_NLIMITS; |
| 954 | |
| 955 | pub const MAP_ANONYMOUS: c_int = MAP_ANON; |
| 956 | |
| 957 | #[doc(hidden)] |
| 958 | #[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] |
| 959 | pub const SIGUNUSED: c_int = crate::SIGSYS; |
| 960 | |
| 961 | pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; |
| 962 | pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; |
| 963 | pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; |
| 964 | |
| 965 | pub const CPU_SETSIZE: c_int = 1024; |
| 966 | |
| 967 | pub const TCSANOW: c_int = 0; |
| 968 | pub const TCSADRAIN: c_int = 1; |
| 969 | pub const TCSAFLUSH: c_int = 2; |
| 970 | |
| 971 | pub const TIOCINQ: c_int = crate::FIONREAD; |
| 972 | |
| 973 | pub const RTLD_GLOBAL: c_int = 0x100; |
| 974 | pub const RTLD_NOLOAD: c_int = 0x4; |
| 975 | |
| 976 | pub const CLOCK_SGI_CYCLE: crate::clockid_t = 10; |
| 977 | |
| 978 | pub const MCL_CURRENT: c_int = 0x0001; |
| 979 | pub const MCL_FUTURE: c_int = 0x0002; |
| 980 | |
| 981 | pub const SIGSTKSZ: size_t = 8192; |
| 982 | pub const MINSIGSTKSZ: size_t = 2048; |
| 983 | pub const CBAUD: crate::tcflag_t = 0o0010017; |
| 984 | pub const TAB1: c_int = 0x00000800; |
| 985 | pub const TAB2: c_int = 0x00001000; |
| 986 | pub const TAB3: c_int = 0x00001800; |
| 987 | pub const CR1: c_int = 0x00000200; |
| 988 | pub const CR2: c_int = 0x00000400; |
| 989 | pub const CR3: c_int = 0x00000600; |
| 990 | pub const FF1: c_int = 0x00008000; |
| 991 | pub const BS1: c_int = 0x00002000; |
| 992 | pub const VT1: c_int = 0x00004000; |
| 993 | pub const VWERASE: usize = 14; |
| 994 | pub const VREPRINT: usize = 12; |
| 995 | pub const VSUSP: usize = 10; |
| 996 | pub const VSTART: usize = 8; |
| 997 | pub const VSTOP: usize = 9; |
| 998 | pub const VDISCARD: usize = 13; |
| 999 | pub const VTIME: usize = 5; |
| 1000 | pub const IXON: crate::tcflag_t = 0x00000400; |
| 1001 | pub const IXOFF: crate::tcflag_t = 0x00001000; |
| 1002 | pub const ONLCR: crate::tcflag_t = 0x4; |
| 1003 | pub const CSIZE: crate::tcflag_t = 0x00000030; |
| 1004 | pub const CS6: crate::tcflag_t = 0x00000010; |
| 1005 | pub const CS7: crate::tcflag_t = 0x00000020; |
| 1006 | pub const CS8: crate::tcflag_t = 0x00000030; |
| 1007 | pub const CSTOPB: crate::tcflag_t = 0x00000040; |
| 1008 | pub const CREAD: crate::tcflag_t = 0x00000080; |
| 1009 | pub const PARENB: crate::tcflag_t = 0x00000100; |
| 1010 | pub const PARODD: crate::tcflag_t = 0x00000200; |
| 1011 | pub const HUPCL: crate::tcflag_t = 0x00000400; |
| 1012 | pub const CLOCAL: crate::tcflag_t = 0x00000800; |
| 1013 | pub const ECHOKE: crate::tcflag_t = 0x00000800; |
| 1014 | pub const ECHOE: crate::tcflag_t = 0x00000010; |
| 1015 | pub const ECHOK: crate::tcflag_t = 0x00000020; |
| 1016 | pub const ECHONL: crate::tcflag_t = 0x00000040; |
| 1017 | pub const ECHOPRT: crate::tcflag_t = 0x00000400; |
| 1018 | pub const ECHOCTL: crate::tcflag_t = 0x00000200; |
| 1019 | pub const ISIG: crate::tcflag_t = 0x00000001; |
| 1020 | pub const ICANON: crate::tcflag_t = 0x00000002; |
| 1021 | pub const PENDIN: crate::tcflag_t = 0x00004000; |
| 1022 | pub const NOFLSH: crate::tcflag_t = 0x00000080; |
| 1023 | pub const CBAUDEX: crate::tcflag_t = 0o010000; |
| 1024 | pub const VSWTC: usize = 7; |
| 1025 | pub const OLCUC: crate::tcflag_t = 0o000002; |
| 1026 | pub const NLDLY: crate::tcflag_t = 0o000400; |
| 1027 | pub const CRDLY: crate::tcflag_t = 0o003000; |
| 1028 | pub const TABDLY: crate::tcflag_t = 0o014000; |
| 1029 | pub const BSDLY: crate::tcflag_t = 0o020000; |
| 1030 | pub const FFDLY: crate::tcflag_t = 0o100000; |
| 1031 | pub const VTDLY: crate::tcflag_t = 0o040000; |
| 1032 | pub const XTABS: crate::tcflag_t = 0o014000; |
| 1033 | |
| 1034 | pub const B0: crate::speed_t = 0o000000; |
| 1035 | pub const B50: crate::speed_t = 0o000001; |
| 1036 | pub const B75: crate::speed_t = 0o000002; |
| 1037 | pub const B110: crate::speed_t = 0o000003; |
| 1038 | pub const B134: crate::speed_t = 0o000004; |
| 1039 | pub const B150: crate::speed_t = 0o000005; |
| 1040 | pub const B200: crate::speed_t = 0o000006; |
| 1041 | pub const B300: crate::speed_t = 0o000007; |
| 1042 | pub const B600: crate::speed_t = 0o000010; |
| 1043 | pub const B1200: crate::speed_t = 0o000011; |
| 1044 | pub const B1800: crate::speed_t = 0o000012; |
| 1045 | pub const B2400: crate::speed_t = 0o000013; |
| 1046 | pub const B4800: crate::speed_t = 0o000014; |
| 1047 | pub const B9600: crate::speed_t = 0o000015; |
| 1048 | pub const B19200: crate::speed_t = 0o000016; |
| 1049 | pub const B38400: crate::speed_t = 0o000017; |
| 1050 | pub const B57600: crate::speed_t = 0o010001; |
| 1051 | pub const B115200: crate::speed_t = 0o010002; |
| 1052 | pub const B230400: crate::speed_t = 0o010003; |
| 1053 | pub const B460800: crate::speed_t = 0o010004; |
| 1054 | pub const B500000: crate::speed_t = 0o010005; |
| 1055 | pub const B576000: crate::speed_t = 0o010006; |
| 1056 | pub const B921600: crate::speed_t = 0o010007; |
| 1057 | pub const B1000000: crate::speed_t = 0o010010; |
| 1058 | pub const B1152000: crate::speed_t = 0o010011; |
| 1059 | pub const B1500000: crate::speed_t = 0o010012; |
| 1060 | pub const B2000000: crate::speed_t = 0o010013; |
| 1061 | pub const B2500000: crate::speed_t = 0o010014; |
| 1062 | pub const B3000000: crate::speed_t = 0o010015; |
| 1063 | pub const B3500000: crate::speed_t = 0o010016; |
| 1064 | pub const B4000000: crate::speed_t = 0o010017; |
| 1065 | |
| 1066 | pub const SO_BINDTODEVICE: c_int = 25; |
| 1067 | pub const SO_TIMESTAMP: c_int = 63; |
| 1068 | pub const SO_MARK: c_int = 36; |
| 1069 | pub const SO_RXQ_OVFL: c_int = 40; |
| 1070 | pub const SO_PEEK_OFF: c_int = 42; |
| 1071 | pub const SO_BUSY_POLL: c_int = 46; |
| 1072 | |
| 1073 | #[cfg(target_pointer_width = "32")] |
| 1074 | pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; |
| 1075 | #[cfg(target_pointer_width = "64")] |
| 1076 | pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; |
| 1077 | #[cfg(target_pointer_width = "32")] |
| 1078 | pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; |
| 1079 | #[cfg(target_pointer_width = "64")] |
| 1080 | pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; |
| 1081 | |
| 1082 | pub const O_DIRECT: c_int = 0x4000; |
| 1083 | pub const O_DIRECTORY: c_int = 0x10000; |
| 1084 | pub const O_NOFOLLOW: c_int = 0x20000; |
| 1085 | pub const O_ASYNC: c_int = 0x2000; |
| 1086 | |
| 1087 | pub const FIOCLEX: c_int = 0x5451; |
| 1088 | pub const FIONBIO: c_int = 0x5421; |
| 1089 | |
| 1090 | pub const RLIMIT_RSS: c_int = 5; |
| 1091 | pub const RLIMIT_NOFILE: c_int = 7; |
| 1092 | pub const RLIMIT_AS: c_int = 9; |
| 1093 | pub const RLIMIT_NPROC: c_int = 6; |
| 1094 | pub const RLIMIT_MEMLOCK: c_int = 8; |
| 1095 | pub const RLIMIT_CPU: c_int = 0; |
| 1096 | pub const RLIMIT_FSIZE: c_int = 1; |
| 1097 | pub const RLIMIT_DATA: c_int = 2; |
| 1098 | pub const RLIMIT_STACK: c_int = 3; |
| 1099 | pub const RLIMIT_CORE: c_int = 4; |
| 1100 | pub const RLIMIT_LOCKS: c_int = 10; |
| 1101 | pub const RLIMIT_SIGPENDING: c_int = 11; |
| 1102 | pub const RLIMIT_MSGQUEUE: c_int = 12; |
| 1103 | pub const RLIMIT_NICE: c_int = 13; |
| 1104 | pub const RLIMIT_RTPRIO: c_int = 14; |
| 1105 | |
| 1106 | pub const O_APPEND: c_int = 1024; |
| 1107 | pub const O_CREAT: c_int = 64; |
| 1108 | pub const O_EXCL: c_int = 128; |
| 1109 | pub const O_NOCTTY: c_int = 256; |
| 1110 | pub const O_NONBLOCK: c_int = 2048; |
| 1111 | pub const O_SYNC: c_int = 1052672; |
| 1112 | pub const O_RSYNC: c_int = 1052672; |
| 1113 | pub const O_DSYNC: c_int = 4096; |
| 1114 | |
| 1115 | pub const SOCK_NONBLOCK: c_int = 2048; |
| 1116 | |
| 1117 | pub const MAP_ANON: c_int = 0x0020; |
| 1118 | pub const MAP_GROWSDOWN: c_int = 0x0100; |
| 1119 | pub const MAP_DENYWRITE: c_int = 0x0800; |
| 1120 | pub const MAP_EXECUTABLE: c_int = 0x01000; |
| 1121 | pub const MAP_LOCKED: c_int = 0x02000; |
| 1122 | pub const MAP_NORESERVE: c_int = 0x04000; |
| 1123 | pub const MAP_POPULATE: c_int = 0x08000; |
| 1124 | pub const MAP_NONBLOCK: c_int = 0x010000; |
| 1125 | pub const MAP_STACK: c_int = 0x020000; |
| 1126 | |
| 1127 | pub const SOCK_STREAM: c_int = 1; |
| 1128 | pub const SOCK_DGRAM: c_int = 2; |
| 1129 | pub const SOCK_SEQPACKET: c_int = 5; |
| 1130 | |
| 1131 | pub const IPPROTO_MAX: c_int = 263; |
| 1132 | |
| 1133 | pub const SOL_SOCKET: c_int = 1; |
| 1134 | |
| 1135 | pub const SO_REUSEADDR: c_int = 2; |
| 1136 | pub const SO_TYPE: c_int = 3; |
| 1137 | pub const SO_ERROR: c_int = 4; |
| 1138 | pub const SO_DONTROUTE: c_int = 5; |
| 1139 | pub const SO_BROADCAST: c_int = 6; |
| 1140 | pub const SO_SNDBUF: c_int = 7; |
| 1141 | pub const SO_RCVBUF: c_int = 8; |
| 1142 | pub const SO_KEEPALIVE: c_int = 9; |
| 1143 | pub const SO_OOBINLINE: c_int = 10; |
| 1144 | pub const SO_LINGER: c_int = 13; |
| 1145 | pub const SO_REUSEPORT: c_int = 15; |
| 1146 | pub const SO_RCVLOWAT: c_int = 18; |
| 1147 | pub const SO_SNDLOWAT: c_int = 19; |
| 1148 | pub const SO_RCVTIMEO: c_int = 66; |
| 1149 | pub const SO_SNDTIMEO: c_int = 67; |
| 1150 | pub const SO_ACCEPTCONN: c_int = 30; |
| 1151 | |
| 1152 | pub const IPV6_RTHDR_LOOSE: c_int = 0; |
| 1153 | pub const IPV6_RTHDR_STRICT: c_int = 1; |
| 1154 | |
| 1155 | pub const SA_ONSTACK: c_int = 0x08000000; |
| 1156 | pub const SA_SIGINFO: c_int = 0x00000004; |
| 1157 | pub const SA_NOCLDWAIT: c_int = 0x00000002; |
| 1158 | |
| 1159 | pub const SIGCHLD: c_int = 17; |
| 1160 | pub const SIGBUS: c_int = 7; |
| 1161 | pub const SIGTTIN: c_int = 21; |
| 1162 | pub const SIGTTOU: c_int = 22; |
| 1163 | pub const SIGXCPU: c_int = 24; |
| 1164 | pub const SIGXFSZ: c_int = 25; |
| 1165 | pub const SIGVTALRM: c_int = 26; |
| 1166 | pub const SIGPROF: c_int = 27; |
| 1167 | pub const SIGWINCH: c_int = 28; |
| 1168 | pub const SIGUSR1: c_int = 10; |
| 1169 | pub const SIGUSR2: c_int = 12; |
| 1170 | pub const SIGCONT: c_int = 18; |
| 1171 | pub const SIGSTOP: c_int = 19; |
| 1172 | pub const SIGTSTP: c_int = 20; |
| 1173 | pub const SIGURG: c_int = 23; |
| 1174 | pub const SIGIO: c_int = 29; |
| 1175 | pub const SIGSYS: c_int = 31; |
| 1176 | pub const SIGSTKFLT: c_int = 16; |
| 1177 | pub const SIGPOLL: c_int = 29; |
| 1178 | pub const SIGPWR: c_int = 30; |
| 1179 | pub const SIG_SETMASK: c_int = 2; |
| 1180 | pub const SIG_BLOCK: c_int = 0x000000; |
| 1181 | pub const SIG_UNBLOCK: c_int = 0x01; |
| 1182 | |
| 1183 | pub const EXTPROC: crate::tcflag_t = 0x00010000; |
| 1184 | |
| 1185 | pub const MAP_HUGETLB: c_int = 0x040000; |
| 1186 | |
| 1187 | pub const F_GETLK: c_int = 12; |
| 1188 | pub const F_GETOWN: c_int = 9; |
| 1189 | pub const F_SETLK: c_int = 13; |
| 1190 | pub const F_SETLKW: c_int = 14; |
| 1191 | pub const F_SETOWN: c_int = 8; |
| 1192 | pub const F_OFD_GETLK: c_int = 36; |
| 1193 | pub const F_OFD_SETLK: c_int = 37; |
| 1194 | pub const F_OFD_SETLKW: c_int = 38; |
| 1195 | |
| 1196 | pub const VEOF: usize = 4; |
| 1197 | pub const VEOL: usize = 11; |
| 1198 | pub const VEOL2: usize = 16; |
| 1199 | pub const VMIN: usize = 6; |
| 1200 | pub const IEXTEN: crate::tcflag_t = 0x00008000; |
| 1201 | pub const TOSTOP: crate::tcflag_t = 0x00000100; |
| 1202 | pub const FLUSHO: crate::tcflag_t = 0x00001000; |
| 1203 | |
| 1204 | pub const TCGETS: c_int = 0x5401; |
| 1205 | pub const TCSETS: c_int = 0x5402; |
| 1206 | pub const TCSETSW: c_int = 0x5403; |
| 1207 | pub const TCSETSF: c_int = 0x5404; |
| 1208 | pub const TCGETA: c_int = 0x5405; |
| 1209 | pub const TCSETA: c_int = 0x5406; |
| 1210 | pub const TCSETAW: c_int = 0x5407; |
| 1211 | pub const TCSETAF: c_int = 0x5408; |
| 1212 | pub const TCSBRK: c_int = 0x5409; |
| 1213 | pub const TCXONC: c_int = 0x540A; |
| 1214 | pub const TCFLSH: c_int = 0x540B; |
| 1215 | pub const TIOCGSOFTCAR: c_int = 0x5419; |
| 1216 | pub const TIOCSSOFTCAR: c_int = 0x541A; |
| 1217 | pub const TIOCLINUX: c_int = 0x541C; |
| 1218 | pub const TIOCGSERIAL: c_int = 0x541E; |
| 1219 | pub const TIOCEXCL: c_int = 0x540C; |
| 1220 | pub const TIOCNXCL: c_int = 0x540D; |
| 1221 | pub const TIOCSCTTY: c_int = 0x540E; |
| 1222 | pub const TIOCGPGRP: c_int = 0x540F; |
| 1223 | pub const TIOCSPGRP: c_int = 0x5410; |
| 1224 | pub const TIOCOUTQ: c_int = 0x5411; |
| 1225 | pub const TIOCSTI: c_int = 0x5412; |
| 1226 | pub const TIOCGWINSZ: c_int = 0x5413; |
| 1227 | pub const TIOCSWINSZ: c_int = 0x5414; |
| 1228 | pub const TIOCMGET: c_int = 0x5415; |
| 1229 | pub const TIOCMBIS: c_int = 0x5416; |
| 1230 | pub const TIOCMBIC: c_int = 0x5417; |
| 1231 | pub const TIOCMSET: c_int = 0x5418; |
| 1232 | pub const FIONREAD: c_int = 0x541B; |
| 1233 | pub const TIOCCONS: c_int = 0x541D; |
| 1234 | |
| 1235 | pub const SYS_gettid: c_long = 224; // Valid for arm (32-bit) and x86 (32-bit) |
| 1236 | |
| 1237 | pub const POLLWRNORM: c_short = 0x100; |
| 1238 | pub const POLLWRBAND: c_short = 0x200; |
| 1239 | |
| 1240 | pub const TIOCM_LE: c_int = 0x001; |
| 1241 | pub const TIOCM_DTR: c_int = 0x002; |
| 1242 | pub const TIOCM_RTS: c_int = 0x004; |
| 1243 | pub const TIOCM_ST: c_int = 0x008; |
| 1244 | pub const TIOCM_SR: c_int = 0x010; |
| 1245 | pub const TIOCM_CTS: c_int = 0x020; |
| 1246 | pub const TIOCM_CAR: c_int = 0x040; |
| 1247 | pub const TIOCM_RNG: c_int = 0x080; |
| 1248 | pub const TIOCM_DSR: c_int = 0x100; |
| 1249 | pub const TIOCM_CD: c_int = TIOCM_CAR; |
| 1250 | pub const TIOCM_RI: c_int = TIOCM_RNG; |
| 1251 | pub const O_TMPFILE: c_int = 0x410000; |
| 1252 | |
| 1253 | pub const MAX_ADDR_LEN: usize = 7; |
| 1254 | pub const ARPD_UPDATE: c_ushort = 0x01; |
| 1255 | pub const ARPD_LOOKUP: c_ushort = 0x02; |
| 1256 | pub const ARPD_FLUSH: c_ushort = 0x03; |
| 1257 | pub const ATF_MAGIC: c_int = 0x80; |
| 1258 | |
| 1259 | pub const PRIO_PROCESS: c_int = 0; |
| 1260 | pub const PRIO_PGRP: c_int = 1; |
| 1261 | pub const PRIO_USER: c_int = 2; |
| 1262 | |
| 1263 | pub const SOMAXCONN: c_int = 128; |
| 1264 | |
| 1265 | f! { |
| 1266 | pub unsafe fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { |
| 1267 | if ((*cmsg).cmsg_len as usize) < size_of::<cmsghdr>() { |
| 1268 | return ptr::null_mut(); |
| 1269 | } |
| 1270 | let next = (cmsg as usize + super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr; |
| 1271 | let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; |
| 1272 | if (next.offset(1)) as usize >= max { |
| 1273 | ptr::null_mut() |
| 1274 | } else { |
| 1275 | next.cast() |
| 1276 | } |
| 1277 | } |
| 1278 | |
| 1279 | pub unsafe fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { |
| 1280 | cpuset.bits.fill(0); |
| 1281 | } |
| 1282 | |
| 1283 | pub unsafe fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { |
| 1284 | let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc |
| 1285 | let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); |
| 1286 | cpuset.bits[idx] |= 1 << offset; |
| 1287 | () |
| 1288 | } |
| 1289 | |
| 1290 | pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { |
| 1291 | let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc |
| 1292 | let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); |
| 1293 | cpuset.bits[idx] &= !(1 << offset); |
| 1294 | () |
| 1295 | } |
| 1296 | |
| 1297 | pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { |
| 1298 | let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); |
| 1299 | let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); |
| 1300 | 0 != (cpuset.bits[idx] & (1 << offset)) |
| 1301 | } |
| 1302 | |
| 1303 | pub unsafe fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { |
| 1304 | set1.bits == set2.bits |
| 1305 | } |
| 1306 | } |
| 1307 | |
| 1308 | safe_f! { |
| 1309 | pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { |
| 1310 | let major = major as crate::dev_t; |
| 1311 | let minor = minor as crate::dev_t; |
| 1312 | let mut dev = 0; |
| 1313 | dev |= (major & 0xfffff000) << 31 << 1; |
| 1314 | dev |= (major & 0x00000fff) << 8; |
| 1315 | dev |= (minor & 0xffffff00) << 12; |
| 1316 | dev |= minor & 0x000000ff; |
| 1317 | dev |
| 1318 | } |
| 1319 | |
| 1320 | pub const safe fn major(dev: crate::dev_t) -> c_uint { |
| 1321 | // see |
| 1322 | // https://github.com/emscripten-core/emscripten/blob/ |
| 1323 | // main/system/lib/libc/musl/include/sys/sysmacros.h |
| 1324 | let mut major = 0; |
| 1325 | major |= (dev >> 31 >> 1) & 0xfffff000; |
| 1326 | major |= (dev >> 8) & 0x00000fff; |
| 1327 | major as c_uint |
| 1328 | } |
| 1329 | |
| 1330 | pub const safe fn minor(dev: crate::dev_t) -> c_uint { |
| 1331 | // see |
| 1332 | // https://github.com/emscripten-core/emscripten/blob/ |
| 1333 | // main/system/lib/libc/musl/include/sys/sysmacros.h |
| 1334 | let mut minor = 0; |
| 1335 | minor |= (dev >> 12) & 0xffffff00; |
| 1336 | minor |= dev & 0x000000ff; |
| 1337 | minor as c_uint |
| 1338 | } |
| 1339 | } |
| 1340 | |
| 1341 | extern "C" { |
| 1342 | pub fn getrlimit(resource: c_int, rlim: *mut crate::rlimit) -> c_int; |
| 1343 | pub fn setrlimit(resource: c_int, rlim: *const crate::rlimit) -> c_int; |
| 1344 | pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int; |
| 1345 | |
| 1346 | pub fn abs(i: c_int) -> c_int; |
| 1347 | pub fn labs(i: c_long) -> c_long; |
| 1348 | pub fn rand() -> c_int; |
| 1349 | pub fn srand(seed: c_uint); |
| 1350 | |
| 1351 | pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int; |
| 1352 | |
| 1353 | pub fn setpwent(); |
| 1354 | pub fn endpwent(); |
| 1355 | pub fn getpwent() -> *mut passwd; |
| 1356 | |
| 1357 | pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int; |
| 1358 | |
| 1359 | pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int; |
| 1360 | pub fn __errno_location() -> *mut c_int; |
| 1361 | |
| 1362 | pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; |
| 1363 | pub fn pwritev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t; |
| 1364 | pub fn preadv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t; |
| 1365 | pub fn dup3(oldfd: c_int, newfd: c_int, flags: c_int) -> c_int; |
| 1366 | pub fn nl_langinfo_l(item: crate::nl_item, locale: crate::locale_t) -> *mut c_char; |
| 1367 | pub fn accept4( |
| 1368 | fd: c_int, |
| 1369 | addr: *mut crate::sockaddr, |
| 1370 | len: *mut crate::socklen_t, |
| 1371 | flg: c_int, |
| 1372 | ) -> c_int; |
| 1373 | pub fn getnameinfo( |
| 1374 | sa: *const crate::sockaddr, |
| 1375 | salen: crate::socklen_t, |
| 1376 | host: *mut c_char, |
| 1377 | hostlen: crate::socklen_t, |
| 1378 | serv: *mut c_char, |
| 1379 | servlen: crate::socklen_t, |
| 1380 | flags: c_int, |
| 1381 | ) -> c_int; |
| 1382 | pub fn getloadavg(loadavg: *mut c_double, nelem: c_int) -> c_int; |
| 1383 | |
| 1384 | pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int; |
| 1385 | |
| 1386 | pub fn mremap( |
| 1387 | addr: *mut c_void, |
| 1388 | len: size_t, |
| 1389 | new_len: size_t, |
| 1390 | flags: c_int, |
| 1391 | ... |
| 1392 | ) -> *mut c_void; |
| 1393 | |
| 1394 | pub fn glob( |
| 1395 | pattern: *const c_char, |
| 1396 | flags: c_int, |
| 1397 | errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>, |
| 1398 | pglob: *mut crate::glob_t, |
| 1399 | ) -> c_int; |
| 1400 | pub fn globfree(pglob: *mut crate::glob_t); |
| 1401 | |
| 1402 | pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; |
| 1403 | |
| 1404 | pub fn shm_unlink(name: *const c_char) -> c_int; |
| 1405 | |
| 1406 | pub fn seekdir(dirp: *mut crate::DIR, loc: c_long); |
| 1407 | |
| 1408 | pub fn telldir(dirp: *mut crate::DIR) -> c_long; |
| 1409 | pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; |
| 1410 | |
| 1411 | pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int; |
| 1412 | |
| 1413 | pub fn recvfrom( |
| 1414 | socket: c_int, |
| 1415 | buf: *mut c_void, |
| 1416 | len: size_t, |
| 1417 | flags: c_int, |
| 1418 | addr: *mut crate::sockaddr, |
| 1419 | addrlen: *mut crate::socklen_t, |
| 1420 | ) -> ssize_t; |
| 1421 | pub fn mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int; |
| 1422 | pub fn nl_langinfo(item: crate::nl_item) -> *mut c_char; |
| 1423 | |
| 1424 | pub fn sendmmsg( |
| 1425 | sockfd: c_int, |
| 1426 | msgvec: *mut crate::mmsghdr, |
| 1427 | vlen: c_uint, |
| 1428 | flags: c_uint, |
| 1429 | ) -> c_int; |
| 1430 | pub fn recvmmsg( |
| 1431 | sockfd: c_int, |
| 1432 | msgvec: *mut crate::mmsghdr, |
| 1433 | vlen: c_uint, |
| 1434 | flags: c_uint, |
| 1435 | timeout: *mut crate::timespec, |
| 1436 | ) -> c_int; |
| 1437 | pub fn sync(); |
| 1438 | pub fn ioctl(fd: c_int, request: c_int, ...) -> c_int; |
| 1439 | pub fn getpriority(which: c_int, who: crate::id_t) -> c_int; |
| 1440 | pub fn setpriority(which: c_int, who: crate::id_t, prio: c_int) -> c_int; |
| 1441 | |
| 1442 | pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int; |
| 1443 | |
| 1444 | // grp.h |
| 1445 | pub fn getgrgid(gid: crate::gid_t) -> *mut crate::group; |
| 1446 | pub fn getgrnam(name: *const c_char) -> *mut crate::group; |
| 1447 | pub fn getgrnam_r( |
| 1448 | name: *const c_char, |
| 1449 | grp: *mut crate::group, |
| 1450 | buf: *mut c_char, |
| 1451 | buflen: size_t, |
| 1452 | result: *mut *mut crate::group, |
| 1453 | ) -> c_int; |
| 1454 | pub fn getgrgid_r( |
| 1455 | gid: crate::gid_t, |
| 1456 | grp: *mut crate::group, |
| 1457 | buf: *mut c_char, |
| 1458 | buflen: size_t, |
| 1459 | result: *mut *mut crate::group, |
| 1460 | ) -> c_int; |
| 1461 | pub fn sigwait(set: *const crate::sigset_t, sig: *mut c_int) -> c_int; |
| 1462 | pub fn sigwaitinfo(set: *const crate::sigset_t, info: *mut crate::siginfo_t) -> c_int; |
| 1463 | pub fn sigtimedwait( |
| 1464 | set: *const crate::sigset_t, |
| 1465 | info: *mut crate::siginfo_t, |
| 1466 | timeout: *const crate::timespec, |
| 1467 | ) -> c_int; |
| 1468 | pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int; |
| 1469 | } |
| 1470 | |
| 1471 | // Alias <foo> to <foo>64 to mimic glibc's LFS64 support |
| 1472 | mod lfs64; |
| 1473 | pub use self::lfs64::*; |