diff --git a/build.rs b/build.rs index 76ca0961e4782..f355447a672c6 100644 --- a/build.rs +++ b/build.rs @@ -16,9 +16,15 @@ fn main() { } if env::var("LIBC_CI").is_ok() { + if let Some(11) = which_freebsd() { + println!("cargo:rustc-cfg=freebsd11"); + } if let Some(12) = which_freebsd() { println!("cargo:rustc-cfg=freebsd12"); } + if let Some(13) = which_freebsd() { + println!("cargo:rustc-cfg=freebsd13"); + } } // Rust >= 1.15 supports private module use: @@ -100,6 +106,7 @@ fn which_freebsd() -> Option { match &stdout { s if s.starts_with("11") => Some(11), s if s.starts_with("12") => Some(12), + s if s.starts_with("13") => Some(13), _ => None, } } diff --git a/ci/build.sh b/ci/build.sh index 707dd4ac9af60..b4ad364aea8ba 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -172,6 +172,8 @@ done # FIXME: https://github.com/rust-lang/rust/issues/58564 # sparc-unknown-linux-gnu +# FIXME: https://github.com/rust-lang/rust/issues/62932 +# thumbv6m-none-eabi RUST_LINUX_NO_CORE_TARGETS="\ aarch64-pc-windows-msvc \ aarch64-unknown-cloudabi \ @@ -184,6 +186,7 @@ armebv7r-none-eabihf \ armv7-unknown-cloudabi-eabihf \ armv7r-none-eabi \ armv7r-none-eabihf \ +hexagon-unknown-linux-musl \ i586-pc-windows-msvc \ i686-pc-windows-msvc \ i686-unknown-cloudabi \ @@ -199,7 +202,7 @@ powerpc64-unknown-freebsd \ riscv32imac-unknown-none-elf \ riscv32imc-unknown-none-elf \ sparc64-unknown-netbsd \ -thumbv6m-none-eabi \ + thumbv7em-none-eabi \ thumbv7em-none-eabihf \ thumbv7m-none-eabi \ diff --git a/ci/docker/wasm32-wasi/Dockerfile b/ci/docker/wasm32-wasi/Dockerfile index d963a442c86bb..eb3b5ff8b7739 100644 --- a/ci/docker/wasm32-wasi/Dockerfile +++ b/ci/docker/wasm32-wasi/Dockerfile @@ -60,7 +60,7 @@ ENV PATH=/root/.cargo/bin:$PATH RUN apt-get install -y --no-install-recommends python RUN git clone --recursive https://github.com/CraneStation/wasmtime wasmtime && \ cd wasmtime && \ - git reset --hard 67edb00f29b62864b00179fe4bfa99bc29973285 + git reset --hard a2647878977726935c3d04c05cabad9607ec7606 RUN cargo build --release --manifest-path wasmtime/Cargo.toml # And finally in the last image we're going to assemble everything together. diff --git a/libc-test/build.rs b/libc-test/build.rs index 6edbd0f2ff506..af7e3b2c0ae7d 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1450,10 +1450,12 @@ fn test_freebsd(target: &str) { let freebsd_ver = which_freebsd(); - if let Some(12) = freebsd_ver { - // If the host is FreeBSD 12, run FreeBSD 12 tests - cfg.cfg("freebsd12", None); - } + match freebsd_ver { + Some(11) => cfg.cfg("freebsd11", None), + Some(12) => cfg.cfg("freebsd12", None), + Some(13) => cfg.cfg("freebsd13", None), + _ => &mut cfg, + }; // Required for `getline`: cfg.define("_WITH_GETLINE", None); @@ -1581,7 +1583,7 @@ fn test_freebsd(target: &str) { | "IP_RECVORIGDSTADDR" | "IPV6_ORIGDSTADDR" | "IPV6_RECVORIGDSTADDR" - if Some(12) != freebsd_ver => + if Some(11) == freebsd_ver => { true } @@ -2468,6 +2470,7 @@ fn which_freebsd() -> Option { match &stdout { s if s.starts_with("11") => Some(11), s if s.starts_with("12") => Some(12), + s if s.starts_with("13") => Some(13), _ => None, } } diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs index 7d7dc2c1d4902..b71b284e42554 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs @@ -189,6 +189,8 @@ cfg_if! { } } +pub const ELAST: ::c_int = 96; + extern { // Return type ::c_int was removed in FreeBSD 12 pub fn setgrent() -> ::c_int; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index ab1b8d98357b3..464744d140da4 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -190,6 +190,15 @@ cfg_if! { } } +cfg_if! { + if #[cfg(not(freebsd13))] { + pub const ELAST: ::c_int = 96; + } else { + pub const EINTEGRITY: ::c_int = 97; + pub const ELAST: ::c_int = 97; + } +} + extern { pub fn setgrent(); pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 9f11c202bb4ea..c178b91b9408e 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -333,7 +333,6 @@ pub const ENOTCAPABLE: ::c_int = 93; pub const ECAPMODE: ::c_int = 94; pub const ENOTRECOVERABLE: ::c_int = 95; pub const EOWNERDEAD: ::c_int = 96; -pub const ELAST: ::c_int = 96; pub const RLIMIT_NPTS: ::c_int = 11; pub const RLIMIT_SWAP: ::c_int = 12; pub const RLIMIT_KQUEUES: ::c_int = 13; @@ -1332,6 +1331,9 @@ cfg_if! { if #[cfg(freebsd12)] { mod freebsd12; pub use self::freebsd12::*; + } else if #[cfg(freebsd13)] { + mod freebsd12; + pub use self::freebsd12::*; } else { mod freebsd11; pub use self::freebsd11::*; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index ce5452062ce3d..f937d772a9a44 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1152,7 +1152,7 @@ extern { pub fn getutxline(ut: *const utmpx) -> *mut utmpx; pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int; #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "kevent@FBSD_1.0" )] pub fn kevent(kq: ::c_int, @@ -1171,7 +1171,7 @@ extern { pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int; #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "mknodat@FBSD_1.1" )] pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 77f82b182bb57..ee644114a4867 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -536,7 +536,7 @@ extern { #[cfg_attr(target_os = "macos", link_name = "glob$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__glob30")] #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "glob@FBSD_1.0" )] pub fn glob(pattern: *const ::c_char, @@ -546,7 +546,7 @@ extern { pglob: *mut ::glob_t) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__globfree30")] #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "globfree@FBSD_1.0" )] pub fn globfree(pglob: *mut ::glob_t); diff --git a/src/unix/linux_like/linux/align.rs b/src/unix/linux_like/linux/align.rs index 0ff4649b8cfcb..be8ac0697633a 100644 --- a/src/unix/linux_like/linux/align.rs +++ b/src/unix/linux_like/linux/align.rs @@ -60,6 +60,7 @@ macro_rules! expand_align { #[cfg_attr(all(target_pointer_width = "32", any(target_arch = "mips", target_arch = "arm", + target_arch = "hexagon", target_arch = "powerpc", target_arch = "x86_64", target_arch = "x86")), @@ -67,6 +68,7 @@ macro_rules! expand_align { #[cfg_attr(any(target_pointer_width = "64", not(any(target_arch = "mips", target_arch = "arm", + target_arch = "hexagon", target_arch = "powerpc", target_arch = "x86_64", target_arch = "x86"))), @@ -79,6 +81,7 @@ macro_rules! expand_align { #[cfg_attr(all(target_pointer_width = "32", any(target_arch = "mips", target_arch = "arm", + target_arch = "hexagon", target_arch = "powerpc", target_arch = "x86_64", target_arch = "x86")), @@ -86,6 +89,7 @@ macro_rules! expand_align { #[cfg_attr(any(target_pointer_width = "64", not(any(target_arch = "mips", target_arch = "arm", + target_arch = "hexagon", target_arch = "powerpc", target_arch = "x86_64", target_arch = "x86"))), diff --git a/src/unix/linux_like/linux/musl/b32/hexagon.rs b/src/unix/linux_like/linux/musl/b32/hexagon.rs new file mode 100644 index 0000000000000..c8666925315ff --- /dev/null +++ b/src/unix/linux_like/linux/musl/b32/hexagon.rs @@ -0,0 +1,795 @@ +pub type c_char = u8; +pub type wchar_t = u32; +pub type stat64 = ::stat; + +s! { + + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::c_ulonglong, + pub st_mode: ::c_uint, + pub st_nlink: ::c_uint, + pub st_uid: ::c_uint, + pub st_gid: ::c_uint, + pub st_rdev: ::c_ulonglong, + __st_rdev_padding: ::c_ulong, + pub st_size: ::c_longlong, + pub st_blksize: ::blksize_t, + __st_blksize_padding: ::c_int, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + + __unused: [::c_int;2], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } + + pub struct ipc_perm { + pub __ipc_perm_key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_ushort, + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + __unused1: ::c_int, + pub shm_dtime: ::time_t, + __unused2: ::c_int, + pub shm_ctime: ::time_t, + __unused3: ::c_int, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::c_ulong, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + pub msg_stime: ::time_t, + __unused1: ::c_int, + pub msg_rtime: ::time_t, + __unused2: ::c_int, + pub msg_ctime: ::time_t, + __unused3: ::c_int, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct statfs { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct statfs64 { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 19], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } +} + +pub const AF_FILE: ::c_int = 1; +pub const AF_KCM: ::c_int = 41; +pub const AF_MAX: ::c_int = 43; +pub const AF_QIPCRTR: ::c_int = 42; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EALREADY: ::c_int = 114; +pub const EBADE: ::c_int = 52; +pub const EBADMSG: ::c_int = 74; +pub const EBADR: ::c_int = 53; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const ECANCELED: ::c_int = 125; +pub const ECHRNG: ::c_int = 44; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNREFUSED: ::c_int = 111; +pub const ECONNRESET: ::c_int = 104; +pub const EDEADLK: ::c_int = 35; +pub const EDEADLOCK: ::c_int = 35; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EDQUOT: ::c_int = 122; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EHWPOISON: ::c_int = 133; +pub const EIDRM: ::c_int = 43; +pub const EILSEQ: ::c_int = 84; +pub const EINPROGRESS: ::c_int = 115; +pub const EISCONN: ::c_int = 106; +pub const EISNAM: ::c_int = 120; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREJECTED: ::c_int = 129; +pub const EKEYREVOKED: ::c_int = 128; +pub const EL2HLT: ::c_int = 51; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBEXEC: ::c_int = 83; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBSCN: ::c_int = 81; +pub const ELNRNG: ::c_int = 48; +pub const ELOOP: ::c_int = 40; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const EMSGSIZE: ::c_int = 90; +pub const EMULTIHOP: ::c_int = 72; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENAVAIL: ::c_int = 119; +pub const ENETDOWN: ::c_int = 100; +pub const ENETRESET: ::c_int = 102; +pub const ENETUNREACH: ::c_int = 101; +pub const ENOANO: ::c_int = 55; +pub const ENOBUFS: ::c_int = 105; +pub const ENOCSI: ::c_int = 50; +pub const ENOKEY: ::c_int = 126; +pub const ENOLCK: ::c_int = 37; +pub const ENOMEDIUM: ::c_int = 123; +pub const ENOMSG: ::c_int = 42; +pub const ENOPROTOOPT: ::c_int = 92; +pub const ENOSYS: ::c_int = 38; +pub const ENOTCONN: ::c_int = 107; +pub const ENOTEMPTY: ::c_int = 39; +pub const ENOTNAM: ::c_int = 118; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const ENOTSOCK: ::c_int = 88; +pub const ENOTSUP: ::c_int = 95; +pub const ENOTUNIQ: ::c_int = 76; +pub const EOPNOTSUPP: ::c_int = 95; +pub const EOVERFLOW: ::c_int = 75; +pub const EOWNERDEAD: ::c_int = 130; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EREMCHG: ::c_int = 78; +pub const ERESTART: ::c_int = 85; +pub const ERFKILL: ::c_int = 132; +pub const ESHUTDOWN: ::c_int = 108; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const ESTALE: ::c_int = 116; +pub const ESTRPIPE: ::c_int = 86; +pub const ETOOMANYREFS: ::c_int = 109; +pub const EUCLEAN: ::c_int = 117; +pub const EUNATCH: ::c_int = 49; +pub const EUSERS: ::c_int = 87; +pub const EXFULL: ::c_int = 54; +pub const EXTPROC: ::c_int = 65536; +pub const F_EXLCK: ::c_int = 4; +pub const F_GETLK: ::c_int = 12; +pub const F_GETOWN: ::c_int = 9; +pub const F_GETOWNER_UIDS: ::c_int = 17; +pub const F_GETOWN_EX: ::c_int = 16; +pub const F_GETSIG: ::c_int = 11; +pub const FIOASYNC: ::c_int = 21586; +pub const FIOCLEX: ::c_int = 21585; +pub const FIONBIO: ::c_int = 21537; +pub const FIONCLEX: ::c_int = 21584; +pub const FIONREAD: ::c_int = 21531; +pub const FIOQSIZE: ::c_int = 21600; +pub const F_LINUX_SPECIFIC_BASE: ::c_int = 1024; +pub const FLUSHO: ::c_int = 4096; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; +pub const F_OWNER_PGRP: ::c_int = 2; +pub const F_OWNER_PID: ::c_int = 1; +pub const F_OWNER_TID: ::c_int = 0; +pub const F_SETLK: ::c_int = 13; +pub const F_SETLKW: ::c_int = 14; +pub const F_SETOWN: ::c_int = 8; +pub const F_SETOWN_EX: ::c_int = 15; +pub const F_SETSIG: ::c_int = 10; +pub const F_SHLCK: ::c_int = 8; +pub const IEXTEN: ::c_int = 32768; +pub const MAP_ANON: ::c_int = 32; +pub const MAP_DENYWRITE: ::c_int = 2048; +pub const MAP_EXECUTABLE: ::c_int = 4096; +pub const MAP_GROWSDOWN: ::c_int = 256; +pub const MAP_HUGE_MASK: ::c_int = 63; +pub const MAP_HUGE_SHIFT: ::c_int = 26; +pub const MAP_HUGETLB: ::c_int = 262144; +pub const MAP_LOCKED: ::c_int = 8192; +pub const MAP_NONBLOCK: ::c_int = 65536; +pub const MAP_NORESERVE: ::c_int = 16384; +pub const MAP_POPULATE: ::c_int = 32768; +pub const MAP_STACK: ::c_int = 131072; +pub const MAP_UNINITIALIZED: ::c_int = 0; +pub const O_APPEND: ::c_int = 1024; +pub const O_ASYNC: ::c_int = 8192; +pub const O_CREAT: ::c_int = 64; +pub const O_DIRECT: ::c_int = 16384; +pub const O_DIRECTORY: ::c_int = 65536; +pub const O_DSYNC: ::c_int = 4096; +pub const O_EXCL: ::c_int = 128; +pub const O_LARGEFILE: ::c_int = 32768; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NOFOLLOW: ::c_int = 131072; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const PF_FILE: ::c_int = 1; +pub const PF_KCM: ::c_int = 41; +pub const PF_MAX: ::c_int = 43; +pub const PF_QIPCRTR: ::c_int = 42; +pub const RLIMIT_AS: ::c_int = 9; +pub const RLIMIT_MEMLOCK: ::c_int = 8; +pub const RLIMIT_NOFILE: ::c_int = 7; +pub const RLIMIT_NPROC: ::c_int = 6; +pub const RLIMIT_RSS: ::c_int = 5; +pub const RLIM_NLIMITS: ::c_int = 16; +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; +pub const SIGBUS: ::c_int = 7; +pub const SIGCHLD: ::c_int = 17; +pub const SIGCONT: ::c_int = 18; +pub const SIGIO: ::c_int = 29; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPROF: ::c_int = 27; +pub const SIGPWR: ::c_int = 30; +pub const SIGSTKFLT: ::c_int = 16; +pub const SIGSTOP: ::c_int = 19; +pub const SIGSYS: ::c_int = 31; +pub const SIGTSTP: ::c_int = 20; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGURG: ::c_int = 23; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGWINCH: ::c_int = 28; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIG_SETMASK: ::c_int = 2; // FIXME check these +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_ATTACH_BPF: ::c_int = 50; +pub const SO_ATTACH_FILTER: ::c_int = 26; +pub const SO_ATTACH_REUSEPORT_CBPF: ::c_int = 51; +pub const SO_ATTACH_REUSEPORT_EBPF: ::c_int = 52; +pub const SO_BPF_EXTENSIONS: ::c_int = 48; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SOCK_DGRAM: ::c_int = 2; +pub const SOCK_NONBLOCK: ::c_int = 2048; +pub const SOCK_SEQPACKET: ::c_int = 5; +pub const SOCK_STREAM: ::c_int = 1; +pub const SO_CNX_ADVICE: ::c_int = 53; +pub const SO_DETACH_BPF: ::c_int = 27; +pub const SO_DETACH_FILTER: ::c_int = 27; +pub const SO_DOMAIN: ::c_int = 39; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_ERROR: ::c_int = 4; +pub const SO_GET_FILTER: ::c_int = 26; +pub const SO_INCOMING_CPU: ::c_int = 49; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SOL_CAIF: ::c_int = 278; +pub const SO_LINGER: ::c_int = 13; +pub const SOL_IUCV: ::c_int = 277; +pub const SOL_KCM: ::c_int = 281; +pub const SOL_NFC: ::c_int = 280; +pub const SO_LOCK_FILTER: ::c_int = 44; +pub const SOL_PNPIPE: ::c_int = 275; +pub const SOL_PPPOL2TP: ::c_int = 273; +pub const SOL_RDS: ::c_int = 276; +pub const SOL_RXRPC: ::c_int = 272; +pub const SOL_SOCKET: ::c_int = 1; +pub const SO_MAX_PACING_RATE: ::c_int = 47; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_NOFCS: ::c_int = 43; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_PASSCRED: ::c_int = 16; +pub const SO_PASSSEC: ::c_int = 34; +pub const SO_PEERCRED: ::c_int = 17; +pub const SO_PEERNAME: ::c_int = 28; +pub const SO_PEERSEC: ::c_int = 31; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; +pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; +pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const SO_TYPE: ::c_int = 3; +pub const SO_WIFI_STATUS: ::c_int = 41; +pub const SYS3264_fadvise64: ::c_int = 223; +pub const SYS3264_fcntl: ::c_int = 25; +pub const SYS3264_fstatat: ::c_int = 79; +pub const SYS3264_fstat: ::c_int = 80; +pub const SYS3264_fstatfs: ::c_int = 44; +pub const SYS3264_ftruncate: ::c_int = 46; +pub const SYS3264_lseek: ::c_int = 62; +pub const SYS3264_lstat: ::c_int = 1039; +pub const SYS3264_mmap: ::c_int = 222; +pub const SYS3264_sendfile: ::c_int = 71; +pub const SYS3264_stat: ::c_int = 1038; +pub const SYS3264_statfs: ::c_int = 43; +pub const SYS3264_truncate: ::c_int = 45; +pub const SYS_accept4: ::c_int = 242; +pub const SYS_accept: ::c_int = 202; +pub const SYS_access: ::c_int = 1033; +pub const SYS_acct: ::c_int = 89; +pub const SYS_add_key: ::c_int = 217; +pub const SYS_adjtimex: ::c_int = 171; +pub const SYS_alarm: ::c_int = 1059; +pub const SYS_arch_specific_syscall: ::c_int = 244; +pub const SYS_bdflush: ::c_int = 1075; +pub const SYS_bind: ::c_int = 200; +pub const SYS_bpf: ::c_int = 280; +pub const SYS_brk: ::c_int = 214; +pub const SYS_capget: ::c_int = 90; +pub const SYS_capset: ::c_int = 91; +pub const SYS_chdir: ::c_int = 49; +pub const SYS_chmod: ::c_int = 1028; +pub const SYS_chown: ::c_int = 1029; +pub const SYS_chroot: ::c_int = 51; +pub const SYS_clock_adjtime: ::c_int = 266; +pub const SYS_clock_getres: ::c_int = 114; +pub const SYS_clock_gettime: ::c_int = 113; +pub const SYS_clock_nanosleep: ::c_int = 115; +pub const SYS_clock_settime: ::c_int = 112; +pub const SYS_clone: ::c_int = 220; +pub const SYS_close: ::c_int = 57; +pub const SYS_connect: ::c_int = 203; +pub const SYS_copy_file_range: ::c_int = -1; // FIXME +pub const SYS_creat: ::c_int = 1064; +pub const SYS_delete_module: ::c_int = 106; +pub const SYS_dup2: ::c_int = 1041; +pub const SYS_dup3: ::c_int = 24; +pub const SYS_dup: ::c_int = 23; +pub const SYS_epoll_create1: ::c_int = 20; +pub const SYS_epoll_create: ::c_int = 1042; +pub const SYS_epoll_ctl: ::c_int = 21; +pub const SYS_epoll_pwait: ::c_int = 22; +pub const SYS_epoll_wait: ::c_int = 1069; +pub const SYS_eventfd2: ::c_int = 19; +pub const SYS_eventfd: ::c_int = 1044; +pub const SYS_execveat: ::c_int = 281; +pub const SYS_execve: ::c_int = 221; +pub const SYS_exit: ::c_int = 93; +pub const SYS_exit_group: ::c_int = 94; +pub const SYS_faccessat: ::c_int = 48; +pub const SYS_fadvise64_64: ::c_int = 223; +pub const SYS_fallocate: ::c_int = 47; +pub const SYS_fanotify_init: ::c_int = 262; +pub const SYS_fanotify_mark: ::c_int = 263; +pub const SYS_fchdir: ::c_int = 50; +pub const SYS_fchmodat: ::c_int = 53; +pub const SYS_fchmod: ::c_int = 52; +pub const SYS_fchownat: ::c_int = 54; +pub const SYS_fchown: ::c_int = 55; +pub const SYS_fcntl64: ::c_int = 25; +pub const SYS_fcntl: ::c_int = 25; +pub const SYS_fdatasync: ::c_int = 83; +pub const SYS_fgetxattr: ::c_int = 10; +pub const SYS_finit_module: ::c_int = 273; +pub const SYS_flistxattr: ::c_int = 13; +pub const SYS_flock: ::c_int = 32; +pub const SYS_fork: ::c_int = 1079; +pub const SYS_fremovexattr: ::c_int = 16; +pub const SYS_fsetxattr: ::c_int = 7; +pub const SYS_fstat64: ::c_int = 80; +pub const SYS_fstatat64: ::c_int = 79; +pub const SYS_fstatfs64: ::c_int = 44; +pub const SYS_fstatfs: ::c_int = 44; +pub const SYS_fsync: ::c_int = 82; +pub const SYS_ftruncate64: ::c_int = 46; +pub const SYS_ftruncate: ::c_int = 46; +pub const SYS_futex: ::c_int = 98; +pub const SYS_futimesat: ::c_int = 1066; +pub const SYS_getcpu: ::c_int = 168; +pub const SYS_getcwd: ::c_int = 17; +pub const SYS_getdents64: ::c_int = 61; +pub const SYS_getdents: ::c_int = 1065; +pub const SYS_getegid: ::c_int = 177; +pub const SYS_geteuid: ::c_int = 175; +pub const SYS_getgid: ::c_int = 176; +pub const SYS_getgroups: ::c_int = 158; +pub const SYS_getitimer: ::c_int = 102; +pub const SYS_get_mempolicy: ::c_int = 236; +pub const SYS_getpeername: ::c_int = 205; +pub const SYS_getpgid: ::c_int = 155; +pub const SYS_getpgrp: ::c_int = 1060; +pub const SYS_getpid: ::c_int = 172; +pub const SYS_getppid: ::c_int = 173; +pub const SYS_getpriority: ::c_int = 141; +pub const SYS_getrandom: ::c_int = 278; +pub const SYS_getresgid: ::c_int = 150; +pub const SYS_getresuid: ::c_int = 148; +pub const SYS_getrlimit: ::c_int = 163; +pub const SYS_get_robust_list: ::c_int = 100; +pub const SYS_getrusage: ::c_int = 165; +pub const SYS_getsid: ::c_int = 156; +pub const SYS_getsockname: ::c_int = 204; +pub const SYS_getsockopt: ::c_int = 209; +pub const SYS_gettid: ::c_int = 178; +pub const SYS_gettimeofday: ::c_int = 169; +pub const SYS_getuid: ::c_int = 174; +pub const SYS_getxattr: ::c_int = 8; +pub const SYS_init_module: ::c_int = 105; +pub const SYS_inotify_add_watch: ::c_int = 27; +pub const SYS_inotify_init1: ::c_int = 26; +pub const SYS_inotify_init: ::c_int = 1043; +pub const SYS_inotify_rm_watch: ::c_int = 28; +pub const SYS_io_cancel: ::c_int = 3; +pub const SYS_ioctl: ::c_int = 29; +pub const SYS_io_destroy: ::c_int = 1; +pub const SYS_io_getevents: ::c_int = 4; +pub const SYS_ioprio_get: ::c_int = 31; +pub const SYS_ioprio_set: ::c_int = 30; +pub const SYS_io_setup: ::c_int = 0; +pub const SYS_io_submit: ::c_int = 2; +pub const SYS_kcmp: ::c_int = 272; +pub const SYS_kexec_load: ::c_int = 104; +pub const SYS_keyctl: ::c_int = 219; +pub const SYS_kill: ::c_int = 129; +pub const SYS_lchown: ::c_int = 1032; +pub const SYS_lgetxattr: ::c_int = 9; +pub const SYS_linkat: ::c_int = 37; +pub const SYS_link: ::c_int = 1025; +pub const SYS_listen: ::c_int = 201; +pub const SYS_listxattr: ::c_int = 11; +pub const SYS_llistxattr: ::c_int = 12; +pub const SYS__llseek: ::c_int = 62; +pub const SYS_lookup_dcookie: ::c_int = 18; +pub const SYS_lremovexattr: ::c_int = 15; +pub const SYS_lseek: ::c_int = 62; +pub const SYS_lsetxattr: ::c_int = 6; +pub const SYS_lstat64: ::c_int = 1039; +pub const SYS_lstat: ::c_int = 1039; +pub const SYS_madvise: ::c_int = 233; +pub const SYS_mbind: ::c_int = 235; +pub const SYS_memfd_create: ::c_int = 279; +pub const SYS_migrate_pages: ::c_int = 238; +pub const SYS_mincore: ::c_int = 232; +pub const SYS_mkdirat: ::c_int = 34; +pub const SYS_mkdir: ::c_int = 1030; +pub const SYS_mknodat: ::c_int = 33; +pub const SYS_mknod: ::c_int = 1027; +pub const SYS_mlockall: ::c_int = 230; +pub const SYS_mlock: ::c_int = 228; +pub const SYS_mmap2: ::c_int = 222; +pub const SYS_mount: ::c_int = 40; +pub const SYS_move_pages: ::c_int = 239; +pub const SYS_mprotect: ::c_int = 226; +pub const SYS_mq_getsetattr: ::c_int = 185; +pub const SYS_mq_notify: ::c_int = 184; +pub const SYS_mq_open: ::c_int = 180; +pub const SYS_mq_timedreceive: ::c_int = 183; +pub const SYS_mq_timedsend: ::c_int = 182; +pub const SYS_mq_unlink: ::c_int = 181; +pub const SYS_mremap: ::c_int = 216; +pub const SYS_msgctl: ::c_int = 187; +pub const SYS_msgget: ::c_int = 186; +pub const SYS_msgrcv: ::c_int = 188; +pub const SYS_msgsnd: ::c_int = 189; +pub const SYS_msync: ::c_int = 227; +pub const SYS_munlockall: ::c_int = 231; +pub const SYS_munlock: ::c_int = 229; +pub const SYS_munmap: ::c_int = 215; +pub const SYS_name_to_handle_at: ::c_int = 264; +pub const SYS_nanosleep: ::c_int = 101; +pub const SYS_newfstatat: ::c_int = 79; +pub const SYS_nfsservctl: ::c_int = 42; +pub const SYS_oldwait4: ::c_int = 1072; +pub const SYS_openat: ::c_int = 56; +pub const SYS_open_by_handle_at: ::c_int = 265; +pub const SYS_open: ::c_int = 1024; +pub const SYS_pause: ::c_int = 1061; +pub const SYS_perf_event_open: ::c_int = 241; +pub const SYS_personality: ::c_int = 92; +pub const SYS_pipe2: ::c_int = 59; +pub const SYS_pipe: ::c_int = 1040; +pub const SYS_pivot_root: ::c_int = 41; +pub const SYS_poll: ::c_int = 1068; +pub const SYS_ppoll: ::c_int = 73; +pub const SYS_prctl: ::c_int = 167; +pub const SYS_pread64: ::c_int = 67; +pub const SYS_preadv: ::c_int = 69; +pub const SYS_prlimit64: ::c_int = 261; +pub const SYS_process_vm_readv: ::c_int = 270; +pub const SYS_process_vm_writev: ::c_int = 271; +pub const SYS_pselect6: ::c_int = 72; +pub const SYS_ptrace: ::c_int = 117; +pub const SYS_pwrite64: ::c_int = 68; +pub const SYS_pwritev: ::c_int = 70; +pub const SYS_quotactl: ::c_int = 60; +pub const SYS_readahead: ::c_int = 213; +pub const SYS_read: ::c_int = 63; +pub const SYS_readlinkat: ::c_int = 78; +pub const SYS_readlink: ::c_int = 1035; +pub const SYS_readv: ::c_int = 65; +pub const SYS_reboot: ::c_int = 142; +pub const SYS_recv: ::c_int = 1073; +pub const SYS_recvfrom: ::c_int = 207; +pub const SYS_recvmmsg: ::c_int = 243; +pub const SYS_recvmsg: ::c_int = 212; +pub const SYS_remap_file_pages: ::c_int = 234; +pub const SYS_removexattr: ::c_int = 14; +pub const SYS_renameat2: ::c_int = 276; +pub const SYS_renameat: ::c_int = 38; +pub const SYS_rename: ::c_int = 1034; +pub const SYS_request_key: ::c_int = 218; +pub const SYS_restart_syscall: ::c_int = 128; +pub const SYS_rmdir: ::c_int = 1031; +pub const SYS_rt_sigaction: ::c_int = 134; +pub const SYS_rt_sigpending: ::c_int = 136; +pub const SYS_rt_sigprocmask: ::c_int = 135; +pub const SYS_rt_sigqueueinfo: ::c_int = 138; +pub const SYS_rt_sigreturn: ::c_int = 139; +pub const SYS_rt_sigsuspend: ::c_int = 133; +pub const SYS_rt_sigtimedwait: ::c_int = 137; +pub const SYS_rt_tgsigqueueinfo: ::c_int = 240; +pub const SYS_sched_getaffinity: ::c_int = 123; +pub const SYS_sched_getattr: ::c_int = 275; +pub const SYS_sched_getparam: ::c_int = 121; +pub const SYS_sched_get_priority_max: ::c_int = 125; +pub const SYS_sched_get_priority_min: ::c_int = 126; +pub const SYS_sched_getscheduler: ::c_int = 120; +pub const SYS_sched_rr_get_interval: ::c_int = 127; +pub const SYS_sched_setaffinity: ::c_int = 122; +pub const SYS_sched_setattr: ::c_int = 274; +pub const SYS_sched_setparam: ::c_int = 118; +pub const SYS_sched_setscheduler: ::c_int = 119; +pub const SYS_sched_yield: ::c_int = 124; +pub const SYS_seccomp: ::c_int = 277; +pub const SYS_select: ::c_int = 1067; +pub const SYS_semctl: ::c_int = 191; +pub const SYS_semget: ::c_int = 190; +pub const SYS_semop: ::c_int = 193; +pub const SYS_semtimedop: ::c_int = 192; +pub const SYS_send: ::c_int = 1074; +pub const SYS_sendfile64: ::c_int = 71; +pub const SYS_sendfile: ::c_int = 71; +pub const SYS_sendmmsg: ::c_int = 269; +pub const SYS_sendmsg: ::c_int = 211; +pub const SYS_sendto: ::c_int = 206; +pub const SYS_setdomainname: ::c_int = 162; +pub const SYS_setfsgid: ::c_int = 152; +pub const SYS_setfsuid: ::c_int = 151; +pub const SYS_setgid: ::c_int = 144; +pub const SYS_setgroups: ::c_int = 159; +pub const SYS_sethostname: ::c_int = 161; +pub const SYS_setitimer: ::c_int = 103; +pub const SYS_set_mempolicy: ::c_int = 237; +pub const SYS_setns: ::c_int = 268; +pub const SYS_setpgid: ::c_int = 154; +pub const SYS_setpriority: ::c_int = 140; +pub const SYS_setregid: ::c_int = 143; +pub const SYS_setresgid: ::c_int = 149; +pub const SYS_setresuid: ::c_int = 147; +pub const SYS_setreuid: ::c_int = 145; +pub const SYS_setrlimit: ::c_int = 164; +pub const SYS_set_robust_list: ::c_int = 99; +pub const SYS_setsid: ::c_int = 157; +pub const SYS_setsockopt: ::c_int = 208; +pub const SYS_set_tid_address: ::c_int = 96; +pub const SYS_settimeofday: ::c_int = 170; +pub const SYS_setuid: ::c_int = 146; +pub const SYS_setxattr: ::c_int = 5; +pub const SYS_shmat: ::c_int = 196; +pub const SYS_shmctl: ::c_int = 195; +pub const SYS_shmdt: ::c_int = 197; +pub const SYS_shmget: ::c_int = 194; +pub const SYS_shutdown: ::c_int = 210; +pub const SYS_sigaltstack: ::c_int = 132; +pub const SYS_signalfd4: ::c_int = 74; +pub const SYS_signalfd: ::c_int = 1045; +pub const SYS_socket: ::c_int = 198; +pub const SYS_socketpair: ::c_int = 199; +pub const SYS_splice: ::c_int = 76; +pub const SYS_stat64: ::c_int = 1038; +pub const SYS_stat: ::c_int = 1038; +pub const SYS_statfs64: ::c_int = 43; +pub const SYS_swapoff: ::c_int = 225; +pub const SYS_swapon: ::c_int = 224; +pub const SYS_symlinkat: ::c_int = 36; +pub const SYS_symlink: ::c_int = 1036; +pub const SYS_sync: ::c_int = 81; +pub const SYS_sync_file_range2: ::c_int = 84; +pub const SYS_sync_file_range: ::c_int = 84; +pub const SYS_syncfs: ::c_int = 267; +pub const SYS_syscalls: ::c_int = 1080; +pub const SYS__sysctl: ::c_int = 1078; +pub const SYS_sysinfo: ::c_int = 179; +pub const SYS_syslog: ::c_int = 116; +pub const SYS_tee: ::c_int = 77; +pub const SYS_tgkill: ::c_int = 131; +pub const SYS_time: ::c_int = 1062; +pub const SYS_timer_create: ::c_int = 107; +pub const SYS_timer_delete: ::c_int = 111; +pub const SYS_timerfd_create: ::c_int = 85; +pub const SYS_timerfd_gettime: ::c_int = 87; +pub const SYS_timerfd_settime: ::c_int = 86; +pub const SYS_timer_getoverrun: ::c_int = 109; +pub const SYS_timer_gettime: ::c_int = 108; +pub const SYS_timer_settime: ::c_int = 110; +pub const SYS_times: ::c_int = 153; +pub const SYS_tkill: ::c_int = 130; +pub const SYS_truncate64: ::c_int = 45; +pub const SYS_truncate: ::c_int = 45; +pub const SYS_umask: ::c_int = 166; +pub const SYS_umount2: ::c_int = 39; +pub const SYS_umount: ::c_int = 1076; +pub const SYS_uname: ::c_int = 160; +pub const SYS_unlinkat: ::c_int = 35; +pub const SYS_unlink: ::c_int = 1026; +pub const SYS_unshare: ::c_int = 97; +pub const SYS_uselib: ::c_int = 1077; +pub const SYS_ustat: ::c_int = 1070; +pub const SYS_utime: ::c_int = 1063; +pub const SYS_utimensat: ::c_int = 88; +pub const SYS_utimes: ::c_int = 1037; +pub const SYS_vfork: ::c_int = 1071; +pub const SYS_vhangup: ::c_int = 58; +pub const SYS_vmsplice: ::c_int = 75; +pub const SYS_wait4: ::c_int = 260; +pub const SYS_waitid: ::c_int = 95; +pub const SYS_write: ::c_int = 64; +pub const SYS_writev: ::c_int = 66; +pub const TCFLSH: ::c_int = 21515; +pub const TCGETA: ::c_int = 21509; +pub const TCGETS: ::c_int = 21505; +pub const TCGETX: ::c_int = 21554; +pub const TCSBRK: ::c_int = 21513; +pub const TCSBRKP: ::c_int = 21541; +pub const TCSETA: ::c_int = 21510; +pub const TCSETAF: ::c_int = 21512; +pub const TCSETAW: ::c_int = 21511; +pub const TCSETS: ::c_int = 21506; +pub const TCSETSF: ::c_int = 21508; +pub const TCSETSW: ::c_int = 21507; +pub const TCSETX: ::c_int = 21555; +pub const TCSETXF: ::c_int = 21556; +pub const TCSETXW: ::c_int = 21557; +pub const TCXONC: ::c_int = 21514; +pub const TIOCCBRK: ::c_int = 21544; +pub const TIOCCONS: ::c_int = 21533; +pub const TIOCEXCL: ::c_int = 21516; +pub const TIOCGETD: ::c_int = 21540; +pub const TIOCGICOUNT: ::c_int = 21597; +pub const TIOCGLCKTRMIOS: ::c_int = 21590; +pub const TIOCGPGRP: ::c_int = 21519; +pub const TIOCGRS485: ::c_int = 21550; +pub const TIOCGSERIAL: ::c_int = 21534; +pub const TIOCGSID: ::c_int = 21545; +pub const TIOCGSOFTCAR: ::c_int = 21529; +pub const TIOCGWINSZ: ::c_int = 21523; +pub const TIOCLINUX: ::c_int = 21532; +pub const TIOCMBIC: ::c_int = 21527; +pub const TIOCMBIS: ::c_int = 21526; +pub const TIOCM_CAR: ::c_int = 64; +pub const TIOCM_CD: ::c_int = 64; +pub const TIOCM_CTS: ::c_int = 32; +pub const TIOCM_DSR: ::c_int = 256; +pub const TIOCM_DTR: ::c_int = 2; +pub const TIOCMGET: ::c_int = 21525; +pub const TIOCMIWAIT: ::c_int = 21596; +pub const TIOCM_LE: ::c_int = 1; +pub const TIOCM_LOOP: ::c_int = 32768; +pub const TIOCM_OUT1: ::c_int = 8192; +pub const TIOCM_OUT2: ::c_int = 16384; +pub const TIOCM_RI: ::c_int = 128; +pub const TIOCM_RNG: ::c_int = 128; +pub const TIOCM_RTS: ::c_int = 4; +pub const TIOCMSET: ::c_int = 21528; +pub const TIOCM_SR: ::c_int = 16; +pub const TIOCM_ST: ::c_int = 8; +pub const TIOCNOTTY: ::c_int = 21538; +pub const TIOCNXCL: ::c_int = 21517; +pub const TIOCOUTQ: ::c_int = 21521; +pub const TIOCPKT: ::c_int = 21536; +pub const TIOCPKT_DATA: ::c_int = 0; +pub const TIOCPKT_DOSTOP: ::c_int = 32; +pub const TIOCPKT_FLUSHREAD: ::c_int = 1; +pub const TIOCPKT_FLUSHWRITE: ::c_int = 2; +pub const TIOCPKT_IOCTL: ::c_int = 64; +pub const TIOCPKT_NOSTOP: ::c_int = 16; +pub const TIOCPKT_START: ::c_int = 8; +pub const TIOCPKT_STOP: ::c_int = 4; +pub const TIOCSBRK: ::c_int = 21543; +pub const TIOCSCTTY: ::c_int = 21518; +pub const TIOCSERCONFIG: ::c_int = 21587; +pub const TIOCSERGETLSR: ::c_int = 21593; +pub const TIOCSERGETMULTI: ::c_int = 21594; +pub const TIOCSERGSTRUCT: ::c_int = 21592; +pub const TIOCSERGWILD: ::c_int = 21588; +pub const TIOCSERSETMULTI: ::c_int = 21595; +pub const TIOCSERSWILD: ::c_int = 21589; +pub const TIOCSER_TEMT: ::c_int = 1; +pub const TIOCSETD: ::c_int = 21539; +pub const TIOCSLCKTRMIOS: ::c_int = 21591; +pub const TIOCSPGRP: ::c_int = 21520; +pub const TIOCSRS485: ::c_int = 21551; +pub const TIOCSSERIAL: ::c_int = 21535; +pub const TIOCSSOFTCAR: ::c_int = 21530; +pub const TIOCSTI: ::c_int = 21522; +pub const TIOCSWINSZ: ::c_int = 21524; +pub const TIOCVHANGUP: ::c_int = 21559; +pub const TOSTOP: ::c_int = 256; +pub const VEOF: ::c_int = 4; +pub const VEOL2: ::c_int = 16; +pub const VEOL: ::c_int = 11; +pub const VMIN: ::c_int = 6; diff --git a/src/unix/linux_like/linux/musl/b32/mod.rs b/src/unix/linux_like/linux/musl/b32/mod.rs index 4128a8e4da6d0..0de23257a7b8f 100644 --- a/src/unix/linux_like/linux/musl/b32/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/mod.rs @@ -56,6 +56,9 @@ cfg_if! { } else if #[cfg(any(target_arch = "powerpc"))] { mod powerpc; pub use self::powerpc::*; + } else if #[cfg(any(target_arch = "hexagon"))] { + mod hexagon; + pub use self::hexagon::*; } else { // Unknown target_arch } diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 46a50e4953523..e47af4f280670 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -414,8 +414,9 @@ cfg_if! { pub use self::b64::*; } else if #[cfg(any(target_arch = "x86", target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc"))] { + target_arch = "powerpc", + target_arch = "hexagon", + target_arch = "arm"))] { mod b32; pub use self::b32::*; } else { } diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 8295dfc020c9c..721d241164a1d 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -567,7 +567,7 @@ extern { #[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")] #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "fstat@FBSD_1.0" )] pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; @@ -577,7 +577,7 @@ extern { #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__stat50")] #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "stat@FBSD_1.0" )] pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; @@ -605,33 +605,13 @@ extern { #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")] pub fn opendir(dirname: *const c_char) -> *mut ::DIR; - #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), - link_name = "fdopendir$INODE64")] - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "fdopendir$INODE64$UNIX2003")] - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - #[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")] #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "readdir@FBSD_1.0" )] pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent; - #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")] - #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")] - #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), - link_name = "readdir_r@FBSD_1.0" - )] - /// The 64-bit libc on Solaris and illumos only has readdir_r. If a - /// 32-bit Solaris or illumos target is ever created, it should use - /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos: - /// https://illumos.org/man/3lib/libc - /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html - /// https://www.unix.com/man-page/opensolaris/3LIB/libc/ - pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, - result: *mut *mut ::dirent) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "closedir$UNIX2003")] pub fn closedir(dirp: *mut ::DIR) -> ::c_int; @@ -641,8 +621,6 @@ extern { link_name = "rewinddir$INODE64$UNIX2003")] pub fn rewinddir(dirp: *mut ::DIR); - pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, - flags: ::c_int, ...) -> ::c_int; pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, flags: ::c_int) -> ::c_int; pub fn fchown(fd: ::c_int, @@ -653,7 +631,7 @@ extern { flags: ::c_int) -> ::c_int; #[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")] #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "fstatat@FBSD_1.1" )] pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char, @@ -661,10 +639,6 @@ extern { pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, flags: ::c_int) -> ::c_int; - pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, - mode: ::mode_t) -> ::c_int; - pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char, - buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t; pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char) -> ::c_int; @@ -725,9 +699,6 @@ extern { pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "pause$UNIX2003")] - pub fn pause() -> ::c_int; pub fn pipe(fds: *mut ::c_int) -> ::c_int; pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, @@ -815,7 +786,7 @@ extern { #[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")] #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "lstat@FBSD_1.0" )] pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; @@ -836,7 +807,6 @@ extern { pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int; - pub fn truncate(path: *const c_char, length: off_t) -> ::c_int; pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; @@ -992,7 +962,7 @@ extern { #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")] #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "mknod@FBSD_1.0" )] pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, @@ -1071,8 +1041,6 @@ extern { #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")] pub fn timegm(tm: *mut ::tm) -> time_t; - pub fn getsid(pid: pid_t) -> pid_t; - pub fn sysconf(name: ::c_int) -> ::c_long; pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; @@ -1131,6 +1099,48 @@ extern { stream: *mut FILE) -> ssize_t; } +cfg_if! { + if #[cfg(not(target_os = "redox"))] { + extern { + pub fn getsid(pid: pid_t) -> pid_t; + pub fn truncate(path: *const c_char, length: off_t) -> ::c_int; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "pause$UNIX2003")] + pub fn pause() -> ::c_int; + + pub fn readlinkat(dirfd: ::c_int, + pathname: *const ::c_char, + buf: *mut ::c_char, + bufsiz: ::size_t) -> ::ssize_t; + pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, + mode: ::mode_t) -> ::c_int; + pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, + flags: ::c_int, ...) -> ::c_int; + + #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), + link_name = "fdopendir$INODE64")] + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "fdopendir$INODE64$UNIX2003")] + pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; + + #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")] + #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")] + #[cfg_attr( + all(target_os = "freebsd", freebsd11), + link_name = "readdir_r@FBSD_1.0" + )] + /// The 64-bit libc on Solaris and illumos only has readdir_r. If a + /// 32-bit Solaris or illumos target is ever created, it should use + /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos: + /// https://illumos.org/man/3lib/libc + /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html + /// https://www.unix.com/man-page/opensolaris/3LIB/libc/ + pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, + result: *mut *mut ::dirent) -> ::c_int; + } + } +} + cfg_if! { if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] { extern { diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index 121bb63a6601f..2591a7938acbb 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -36,6 +36,49 @@ pub type suseconds_t = ::c_int; pub type tcflag_t = u32; pub type time_t = ::c_long; +#[cfg_attr(feature = "extra_traits", derive(Debug))] +pub enum timezone {} +impl ::Copy for timezone {} +impl ::Clone for timezone { + fn clone(&self) -> timezone { *self } +} + +s_no_extra_traits! { + #[repr(C)] + pub struct utsname { + pub sysname: [::c_char; UTSLENGTH], + pub nodename: [::c_char; UTSLENGTH], + pub release: [::c_char; UTSLENGTH], + pub version: [::c_char; UTSLENGTH], + pub machine: [::c_char; UTSLENGTH], + pub domainname: [::c_char; UTSLENGTH], + } + + pub struct dirent { + pub d_ino: ::ino_t, + pub d_off: ::off_t, + pub d_reclen: ::c_ushort, + pub d_type: ::c_uchar, + pub d_name: [::c_char; 256], + } + + pub struct sockaddr_un { + pub sun_family: ::sa_family_t, + pub sun_path: [::c_char; 108] + } + + pub struct sockaddr_storage { + pub ss_family: ::sa_family_t, + __ss_padding: [ + u8; + 128 - + ::core::mem::size_of::() - + ::core::mem::size_of::() + ], + __ss_align: ::c_ulong, + } +} + s! { pub struct addrinfo { pub ai_flags: ::c_int, @@ -48,14 +91,6 @@ s! { pub ai_next: *mut ::addrinfo, } - pub struct dirent { - pub d_ino: ::ino_t, - pub d_off: ::off_t, - pub d_reclen: ::c_ushort, - pub d_type: ::c_uchar, - pub d_name: [::c_char; 256], - } - pub struct Dl_info { pub dli_fname: *const ::c_char, pub dli_fbase: *mut ::c_void, @@ -140,22 +175,6 @@ s! { pub sin6_scope_id: u32, } - pub struct sockaddr_storage { - pub ss_family: ::sa_family_t, - __ss_padding: [ - u8; - 128 - - ::core::mem::size_of::() - - ::core::mem::size_of::() - ], - __ss_align: ::c_ulong, - } - - pub struct sockaddr_un { - pub sun_family: ::sa_family_t, - pub sun_path: [::c_char; 108] - } - pub struct stat { pub st_dev: ::dev_t, pub st_ino: ::ino_t, @@ -216,63 +235,175 @@ s! { } } +pub const UTSLENGTH: usize = 65; + +// intentionally not public, only used for fd_set +cfg_if! { + if #[cfg(target_pointer_width = "32")] { + const ULONG_SIZE: usize = 32; + } else if #[cfg(target_pointer_width = "64")] { + const ULONG_SIZE: usize = 64; + } else { + // Unknown target_pointer_width + } +} + +// limits.h +pub const PATH_MAX: ::c_int = 4096; + +// fcntl.h +pub const F_GETLK: ::c_int = 5; +pub const F_SETLK: ::c_int = 6; +pub const F_SETLKW: ::c_int = 7; + // TODO: relibc { - pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; +pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; // } // dlfcn.h - pub const RTLD_LAZY: ::c_int = 0x0001; pub const RTLD_NOW: ::c_int = 0x0002; pub const RTLD_GLOBAL: ::c_int = 0x0100; pub const RTLD_LOCAL: ::c_int = 0x0000; // errno.h -pub const EPERM: ::c_int = 1; -pub const ENOENT: ::c_int = 2; -pub const ESRCH: ::c_int = 3; -pub const EINTR: ::c_int = 4; -pub const EIO: ::c_int = 5; -pub const ENXIO: ::c_int = 6; -pub const E2BIG: ::c_int = 7; -pub const ENOEXEC: ::c_int = 8; -pub const EBADF: ::c_int = 9; -pub const ECHILD: ::c_int = 10; -pub const EAGAIN: ::c_int = 11; -pub const ENOMEM: ::c_int = 12; -pub const EACCES: ::c_int = 13; -pub const EFAULT: ::c_int = 14; -pub const ENOTBLK: ::c_int = 15; -pub const EBUSY: ::c_int = 16; -pub const EEXIST: ::c_int = 17; -pub const EXDEV: ::c_int = 18; -pub const ENODEV: ::c_int = 19; -pub const ENOTDIR: ::c_int = 20; -pub const EISDIR: ::c_int = 21; -pub const EINVAL: ::c_int = 22; -pub const ENFILE: ::c_int = 23; -pub const EMFILE: ::c_int = 24; -pub const ENOTTY: ::c_int = 25; -pub const ETXTBSY: ::c_int = 26; -pub const EFBIG: ::c_int = 27; -pub const ENOSPC: ::c_int = 28; -pub const ESPIPE: ::c_int = 29; -pub const EROFS: ::c_int = 30; -pub const EMLINK: ::c_int = 31; -pub const EPIPE: ::c_int = 32; -pub const EDOM: ::c_int = 33; -pub const ERANGE: ::c_int = 34; -pub const EDEADLK: ::c_int = 35; -pub const ENOSYS: ::c_int = 38; -pub const EWOULDBLOCK: ::c_int = 41; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOTCONN: ::c_int = 107; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EINPROGRESS: ::c_int = 115; +pub const EPERM: ::c_int = 1; /* Operation not permitted */ +pub const ENOENT: ::c_int = 2; /* No such file or directory */ +pub const ESRCH: ::c_int = 3; /* No such process */ +pub const EINTR: ::c_int = 4; /* Interrupted system call */ +pub const EIO: ::c_int = 5; /* I/O error */ +pub const ENXIO: ::c_int = 6; /* No such device or address */ +pub const E2BIG: ::c_int = 7; /* Argument list too long */ +pub const ENOEXEC: ::c_int = 8; /* Exec format error */ +pub const EBADF: ::c_int = 9; /* Bad file number */ +pub const ECHILD: ::c_int = 10; /* No child processes */ +pub const EAGAIN: ::c_int = 11; /* Try again */ +pub const ENOMEM: ::c_int = 12; /* Out of memory */ +pub const EACCES: ::c_int = 13; /* Permission denied */ +pub const EFAULT: ::c_int = 14; /* Bad address */ +pub const ENOTBLK: ::c_int = 15; /* Block device required */ +pub const EBUSY: ::c_int = 16; /* Device or resource busy */ +pub const EEXIST: ::c_int = 17; /* File exists */ +pub const EXDEV: ::c_int = 18; /* Cross-device link */ +pub const ENODEV: ::c_int = 19; /* No such device */ +pub const ENOTDIR: ::c_int = 20; /* Not a directory */ +pub const EISDIR: ::c_int = 21; /* Is a directory */ +pub const EINVAL: ::c_int = 22; /* Invalid argument */ +pub const ENFILE: ::c_int = 23; /* File table overflow */ +pub const EMFILE: ::c_int = 24; /* Too many open files */ +pub const ENOTTY: ::c_int = 25; /* Not a typewriter */ +pub const ETXTBSY: ::c_int = 26; /* Text file busy */ +pub const EFBIG: ::c_int = 27; /* File too large */ +pub const ENOSPC: ::c_int = 28; /* No space left on device */ +pub const ESPIPE: ::c_int = 29; /* Illegal seek */ +pub const EROFS: ::c_int = 30; /* Read-only file system */ +pub const EMLINK: ::c_int = 31; /* Too many links */ +pub const EPIPE: ::c_int = 32; /* Broken pipe */ +pub const EDOM: ::c_int = 33; /* Math argument out of domain of func */ +pub const ERANGE: ::c_int = 34; /* Math result not representable */ +pub const EDEADLK: ::c_int = 35; /* Resource deadlock would occur */ +pub const ENAMETOOLONG: ::c_int = 36; /* File name too long */ +pub const ENOLCK: ::c_int = 37; /* No record locks available */ +pub const ENOSYS: ::c_int = 38; /* Function not implemented */ +pub const ENOTEMPTY: ::c_int = 39; /* Directory not empty */ +pub const ELOOP: ::c_int = 40; /* Too many symbolic links encountered */ +pub const EWOULDBLOCK: ::c_int = 41; /* Operation would block */ +pub const ENOMSG: ::c_int = 42; /* No message of desired type */ +pub const EIDRM: ::c_int = 43; /* Identifier removed */ +pub const ECHRNG: ::c_int = 44; /* Channel number out of range */ +pub const EL2NSYNC: ::c_int = 45; /* Level 2 not synchronized */ +pub const EL3HLT: ::c_int = 46; /* Level 3 halted */ +pub const EL3RST: ::c_int = 47; /* Level 3 reset */ +pub const ELNRNG: ::c_int = 48; /* Link number out of range */ +pub const EUNATCH: ::c_int = 49; /* Protocol driver not attached */ +pub const ENOCSI: ::c_int = 50; /* No CSI structure available */ +pub const EL2HLT: ::c_int = 51; /* Level 2 halted */ +pub const EBADE: ::c_int = 52; /* Invalid exchange */ +pub const EBADR: ::c_int = 53; /* Invalid request descriptor */ +pub const EXFULL: ::c_int = 54; /* Exchange full */ +pub const ENOANO: ::c_int = 55; /* No anode */ +pub const EBADRQC: ::c_int = 56; /* Invalid request code */ +pub const EBADSLT: ::c_int = 57; /* Invalid slot */ +pub const EDEADLOCK: ::c_int = 58; /* Resource deadlock would occur */ +pub const EBFONT: ::c_int = 59; /* Bad font file format */ +pub const ENOSTR: ::c_int = 60; /* Device not a stream */ +pub const ENODATA: ::c_int = 61; /* No data available */ +pub const ETIME: ::c_int = 62; /* Timer expired */ +pub const ENOSR: ::c_int = 63; /* Out of streams resources */ +pub const ENONET: ::c_int = 64; /* Machine is not on the network */ +pub const ENOPKG: ::c_int = 65; /* Package not installed */ +pub const EREMOTE: ::c_int = 66; /* Object is remote */ +pub const ENOLINK: ::c_int = 67; /* Link has been severed */ +pub const EADV: ::c_int = 68; /* Advertise error */ +pub const ESRMNT: ::c_int = 69; /* Srmount error */ +pub const ECOMM: ::c_int = 70; /* Communication error on send */ +pub const EPROTO: ::c_int = 71; /* Protocol error */ +pub const EMULTIHOP: ::c_int = 72; /* Multihop attempted */ +pub const EDOTDOT: ::c_int = 73; /* RFS specific error */ +pub const EBADMSG: ::c_int = 74; /* Not a data message */ +pub const EOVERFLOW: ::c_int = 75; /* Value too large for defined data type */ +pub const ENOTUNIQ: ::c_int = 76; /* Name not unique on network */ +pub const EBADFD: ::c_int = 77; /* File descriptor in bad state */ +pub const EREMCHG: ::c_int = 78; /* Remote address changed */ +pub const ELIBACC: ::c_int = 79; /* Can not access a needed shared library */ +pub const ELIBBAD: ::c_int = 80; /* Accessing a corrupted shared library */ +pub const ELIBSCN: ::c_int = 81; /* .lib section in a.out corrupted */ +/* Attempting to link in too many shared libraries */ +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; /* Cannot exec a shared library directly */ +pub const EILSEQ: ::c_int = 84; /* Illegal byte sequence */ +/* Interrupted system call should be restarted */ +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; /* Streams pipe error */ +pub const EUSERS: ::c_int = 87; /* Too many users */ +pub const ENOTSOCK: ::c_int = 88; /* Socket operation on non-socket */ +pub const EDESTADDRREQ: ::c_int = 89; /* Destination address required */ +pub const EMSGSIZE: ::c_int = 90; /* Message too long */ +pub const EPROTOTYPE: ::c_int = 91; /* Protocol wrong type for socket */ +pub const ENOPROTOOPT: ::c_int = 92; /* Protocol not available */ +pub const EPROTONOSUPPORT: ::c_int = 93; /* Protocol not supported */ +pub const ESOCKTNOSUPPORT: ::c_int = 94; /* Socket type not supported */ +/* Operation not supported on transport endpoint */ +pub const EOPNOTSUPP: ::c_int = 95; +pub const EPFNOSUPPORT: ::c_int = 96; /* Protocol family not supported */ +/* Address family not supported by protocol */ +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; /* Address already in use */ +pub const EADDRNOTAVAIL: ::c_int = 99; /* Cannot assign requested address */ +pub const ENETDOWN: ::c_int = 100; /* Network is down */ +pub const ENETUNREACH: ::c_int = 101; /* Network is unreachable */ +/* Network dropped connection because of reset */ +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; /* Software caused connection abort */ +pub const ECONNRESET: ::c_int = 104; /* Connection reset by peer */ +pub const ENOBUFS: ::c_int = 105; /* No buffer space available */ +pub const EISCONN: ::c_int = 106; /* Transport endpoint is already connected */ +pub const ENOTCONN: ::c_int = 107; /* Transport endpoint is not connected */ +/* Cannot send after transport endpoint shutdown */ +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; /* Too many references: cannot splice */ +pub const ETIMEDOUT: ::c_int = 110; /* Connection timed out */ +pub const ECONNREFUSED: ::c_int = 111; /* Connection refused */ +pub const EHOSTDOWN: ::c_int = 112; /* Host is down */ +pub const EHOSTUNREACH: ::c_int = 113; /* No route to host */ +pub const EALREADY: ::c_int = 114; /* Operation already in progress */ +pub const EINPROGRESS: ::c_int = 115; /* Operation now in progress */ +pub const ESTALE: ::c_int = 116; /* Stale NFS file handle */ +pub const EUCLEAN: ::c_int = 117; /* Structure needs cleaning */ +pub const ENOTNAM: ::c_int = 118; /* Not a XENIX named type file */ +pub const ENAVAIL: ::c_int = 119; /* No XENIX semaphores available */ +pub const EISNAM: ::c_int = 120; /* Is a named type file */ +pub const EREMOTEIO: ::c_int = 121; /* Remote I/O error */ +pub const EDQUOT: ::c_int = 122; /* Quota exceeded */ +pub const ENOMEDIUM: ::c_int = 123; /* No medium found */ +pub const EMEDIUMTYPE: ::c_int = 124; /* Wrong medium type */ +pub const ECANCELED: ::c_int = 125; /* Operation Canceled */ +pub const ENOKEY: ::c_int = 126; /* Required key not available */ +pub const EKEYEXPIRED: ::c_int = 127; /* Key has expired */ +pub const EKEYREVOKED: ::c_int = 128; /* Key has been revoked */ +pub const EKEYREJECTED: ::c_int = 129; /* Key was rejected by service */ +pub const EOWNERDEAD: ::c_int = 130; /* Owner died */ +pub const ENOTRECOVERABLE: ::c_int = 131; /* State not recoverable */ // fcntl.h pub const F_DUPFD: ::c_int = 0; @@ -281,7 +412,7 @@ pub const F_SETFD: ::c_int = 2; pub const F_GETFL: ::c_int = 3; pub const F_SETFL: ::c_int = 4; // TODO: relibc { - pub const F_DUPFD_CLOEXEC: ::c_int = ::F_DUPFD; +pub const F_DUPFD_CLOEXEC: ::c_int = ::F_DUPFD; // } pub const FD_CLOEXEC: ::c_int = 0x0100_0000; pub const O_RDONLY: ::c_int = 0x0001_0000; @@ -310,25 +441,25 @@ pub const EAI_SYSTEM: ::c_int = -11; // netinet/in.h // TODO: relibc { - pub const IP_TTL: ::c_int = 2; - pub const IPV6_UNICAST_HOPS: ::c_int = 16; - pub const IPV6_MULTICAST_IF: ::c_int = 17; - pub const IPV6_MULTICAST_HOPS: ::c_int = 18; - pub const IPV6_MULTICAST_LOOP: ::c_int = 19; - pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; - pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; - pub const IPV6_V6ONLY: ::c_int = 26; - pub const IP_MULTICAST_IF: ::c_int = 32; - pub const IP_MULTICAST_TTL: ::c_int = 33; - pub const IP_MULTICAST_LOOP: ::c_int = 34; - pub const IP_ADD_MEMBERSHIP: ::c_int = 35; - pub const IP_DROP_MEMBERSHIP: ::c_int = 36; +pub const IP_TTL: ::c_int = 2; +pub const IPV6_UNICAST_HOPS: ::c_int = 16; +pub const IPV6_MULTICAST_IF: ::c_int = 17; +pub const IPV6_MULTICAST_HOPS: ::c_int = 18; +pub const IPV6_MULTICAST_LOOP: ::c_int = 19; +pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; +pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; +pub const IPV6_V6ONLY: ::c_int = 26; +pub const IP_MULTICAST_IF: ::c_int = 32; +pub const IP_MULTICAST_TTL: ::c_int = 33; +pub const IP_MULTICAST_LOOP: ::c_int = 34; +pub const IP_ADD_MEMBERSHIP: ::c_int = 35; +pub const IP_DROP_MEMBERSHIP: ::c_int = 36; // } // netinet/tcp.h pub const TCP_NODELAY: ::c_int = 1; // TODO: relibc { - pub const TCP_KEEPIDLE: ::c_int = 1; +pub const TCP_KEEPIDLE: ::c_int = 1; // } // poll.h @@ -345,7 +476,7 @@ pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; pub const PTHREAD_MUTEX_INITIALIZER: ::pthread_mutex_t = -1isize as *mut _; pub const PTHREAD_COND_INITIALIZER: ::pthread_cond_t = -1isize as *mut _; pub const PTHREAD_RWLOCK_INITIALIZER: ::pthread_rwlock_t = -1isize as *mut _; -pub const PTHREAD_STACK_MIN : ::size_t = 4096; +pub const PTHREAD_STACK_MIN: ::size_t = 4096; // signal.h pub const SIG_BLOCK: ::c_int = 0; @@ -384,6 +515,15 @@ pub const SIGPWR: ::c_int = 30; pub const SIGSYS: ::c_int = 31; pub const NSIG: ::c_int = 32; +pub const SA_NOCLDSTOP: ::c_ulong = 0x00000001; +pub const SA_NOCLDWAIT: ::c_ulong = 0x00000002; +pub const SA_SIGINFO: ::c_ulong = 0x00000004; +pub const SA_RESTORER: ::c_ulong = 0x04000000; +pub const SA_ONSTACK: ::c_ulong = 0x08000000; +pub const SA_RESTART: ::c_ulong = 0x10000000; +pub const SA_NODEFER: ::c_ulong = 0x40000000; +pub const SA_RESETHAND: ::c_ulong = 0x80000000; + // sys/epoll.h pub const EPOLL_CLOEXEC: ::c_int = 0x0100_0000; pub const EPOLL_CTL_ADD: ::c_int = 1; @@ -434,8 +574,8 @@ pub const EXIT_FAILURE: ::c_int = 1; // sys/ioctl.h // TODO: relibc { - pub const FIONBIO: ::c_ulong = 0x5421; - pub const FIOCLEX: ::c_ulong = 0x5451; +pub const FIONBIO: ::c_ulong = 0x5421; +pub const FIOCLEX: ::c_ulong = 0x5451; // } pub const TCGETS: ::c_ulong = 0x5401; pub const TCSETS: ::c_ulong = 0x5402; @@ -472,6 +612,17 @@ pub const SOL_SOCKET: ::c_int = 1; // sys/wait.h pub const WNOHANG: ::c_int = 1; +pub const WUNTRACED: ::c_int = 2; + +pub const WSTOPPED: ::c_int = 2; +pub const WEXITED: ::c_int = 4; +pub const WCONTINUED: ::c_int = 8; +pub const WNOWAIT: ::c_int = 0x0100_0000; + +pub const __WNOTHREAD: ::c_int = 0x2000_0000; +pub const __WALL: ::c_int = 0x4000_0000; +#[allow(overflowing_literals)] +pub const __WCLONE: ::c_int = 0x8000_0000; // termios.h pub const NCCS: usize = 32; @@ -481,7 +632,34 @@ pub const CLOCK_REALTIME: ::c_int = 1; pub const CLOCK_MONOTONIC: ::c_int = 4; // unistd.h +// POSIX.1 { +pub const _SC_ARG_MAX: ::c_int = 0; +pub const _SC_CHILD_MAX: ::c_int = 1; +pub const _SC_CLK_TCK: ::c_int = 2; +pub const _SC_NGROUPS_MAX: ::c_int = 3; +pub const _SC_OPEN_MAX: ::c_int = 4; +pub const _SC_STREAM_MAX: ::c_int = 5; +pub const _SC_TZNAME_MAX: ::c_int = 6; +// ... +pub const _SC_VERSION: ::c_int = 29; pub const _SC_PAGESIZE: ::c_int = 30; +pub const _SC_PAGE_SIZE: ::c_int = 30; +// ... +pub const _SC_RE_DUP_MAX: ::c_int = 44; +// ... +pub const _SC_LOGIN_NAME_MAX: ::c_int = 71; +pub const _SC_TTY_NAME_MAX: ::c_int = 72; +// ... +pub const _SC_SYMLOOP_MAX: ::c_int = 173; +// ... +pub const _SC_HOST_NAME_MAX: ::c_int = 180; +// } POSIX.1 + +pub const F_OK: ::c_int = 0; +pub const R_OK: ::c_int = 4; +pub const W_OK: ::c_int = 2; +pub const X_OK: ::c_int = 1; + pub const SEEK_SET: ::c_int = 0; pub const SEEK_CUR: ::c_int = 1; pub const SEEK_END: ::c_int = 2; @@ -489,109 +667,327 @@ pub const STDIN_FILENO: ::c_int = 0; pub const STDOUT_FILENO: ::c_int = 1; pub const STDERR_FILENO: ::c_int = 2; -// wait.h -pub fn WIFSTOPPED(status: ::c_int) -> bool { - (status & 0xff) == 0x7f -} +pub const _PC_LINK_MAX: ::c_int = 0; +pub const _PC_MAX_CANON: ::c_int = 1; +pub const _PC_MAX_INPUT: ::c_int = 2; +pub const _PC_NAME_MAX: ::c_int = 3; +pub const _PC_PATH_MAX: ::c_int = 4; +pub const _PC_PIPE_BUF: ::c_int = 5; +pub const _PC_CHOWN_RESTRICTED: ::c_int = 6; +pub const _PC_NO_TRUNC: ::c_int = 7; +pub const _PC_VDISABLE: ::c_int = 8; +pub const _PC_SYNC_IO: ::c_int = 9; +pub const _PC_ASYNC_IO: ::c_int = 10; +pub const _PC_PRIO_IO: ::c_int = 11; +pub const _PC_SOCK_MAXBUF: ::c_int = 12; +pub const _PC_FILESIZEBITS: ::c_int = 13; +pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14; +pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15; +pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16; +pub const _PC_REC_XFER_ALIGN: ::c_int = 17; +pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18; +pub const _PC_SYMLINK_MAX: ::c_int = 19; +pub const _PC_2_SYMLINKS: ::c_int = 20; -pub fn WSTOPSIG(status: ::c_int) -> ::c_int { - (status >> 8) & 0xff -} +// wait.h +f! { + pub fn WIFSTOPPED(status: ::c_int) -> bool { + (status & 0xff) == 0x7f + } -pub fn WIFCONTINUED(status: ::c_int) -> bool { - status == 0xffff -} + pub fn WSTOPSIG(status: ::c_int) -> ::c_int { + (status >> 8) & 0xff + } -pub fn WIFSIGNALED(status: ::c_int) -> bool { - ((status & 0x7f) + 1) as i8 >= 2 -} + pub fn WIFCONTINUED(status: ::c_int) -> bool { + status == 0xffff + } -pub fn WTERMSIG(status: ::c_int) -> ::c_int { - status & 0x7f -} + pub fn WIFSIGNALED(status: ::c_int) -> bool { + ((status & 0x7f) + 1) as i8 >= 2 + } -pub fn WIFEXITED(status: ::c_int) -> bool { - (status & 0x7f) == 0 -} + pub fn WTERMSIG(status: ::c_int) -> ::c_int { + status & 0x7f + } -pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { - (status >> 8) & 0xff -} + pub fn WIFEXITED(status: ::c_int) -> bool { + (status & 0x7f) == 0 + } -pub fn WCOREDUMP(status: ::c_int) -> bool { - (status & 0x80) != 0 -} + pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { + (status >> 8) & 0xff + } -// intentionally not public, only used for fd_set -cfg_if! { - if #[cfg(target_pointer_width = "32")] { - const ULONG_SIZE: usize = 32; - } else if #[cfg(target_pointer_width = "64")] { - const ULONG_SIZE: usize = 64; - } else { - // Unknown target_pointer_width + pub fn WCOREDUMP(status: ::c_int) -> bool { + (status & 0x80) != 0 } } extern { - pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; - pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; - + // errno.h + pub fn __errno_location() -> *mut ::c_int; pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; - pub fn __errno_location() -> *mut ::c_int; + + // unistd.h + pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; // malloc.h pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; // pthread.h - pub fn pthread_atfork(prepare: ::Option, - parent: ::Option, - child: ::Option) -> ::c_int; - pub fn pthread_create(tid: *mut ::pthread_t, - attr: *const ::pthread_attr_t, - start: extern fn(*mut ::c_void) -> *mut ::c_void, - arg: *mut ::c_void) -> ::c_int; - pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, - clock_id: ::clockid_t) -> ::c_int; + pub fn pthread_atfork( + prepare: ::Option, + parent: ::Option, + child: ::Option, + ) -> ::c_int; + pub fn pthread_create( + tid: *mut ::pthread_t, + attr: *const ::pthread_attr_t, + start: extern fn(*mut ::c_void) -> *mut ::c_void, + arg: *mut ::c_void, + ) -> ::c_int; + pub fn pthread_condattr_setclock( + attr: *mut pthread_condattr_t, + clock_id: ::clockid_t, + ) -> ::c_int; + + // pwd.h + pub fn getpwuid_r(uid: ::uid_t, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd) -> ::c_int; // signal.h - pub fn pthread_sigmask(how: ::c_int, - set: *const ::sigset_t, - oldset: *mut ::sigset_t) -> ::c_int; + pub fn pthread_sigmask( + how: ::c_int, + set: *const ::sigset_t, + oldset: *mut ::sigset_t, + ) -> ::c_int; // sys/epoll.h pub fn epoll_create(size: ::c_int) -> ::c_int; pub fn epoll_create1(flags: ::c_int) -> ::c_int; - pub fn epoll_wait(epfd: ::c_int, - events: *mut ::epoll_event, - maxevents: ::c_int, - timeout: ::c_int) -> ::c_int; - pub fn epoll_ctl(epfd: ::c_int, - op: ::c_int, - fd: ::c_int, - event: *mut ::epoll_event) -> ::c_int; + pub fn epoll_wait( + epfd: ::c_int, + events: *mut ::epoll_event, + maxevents: ::c_int, + timeout: ::c_int, + ) -> ::c_int; + pub fn epoll_ctl( + epfd: ::c_int, + op: ::c_int, + fd: ::c_int, + event: *mut ::epoll_event, + ) -> ::c_int; // sys/ioctl.h pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; + // sys/resource.h + pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; + // sys/socket.h - pub fn bind(socket: ::c_int, address: *const ::sockaddr, - address_len: ::socklen_t) -> ::c_int; - pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, - flags: ::c_int, addr: *mut ::sockaddr, - addrlen: *mut ::socklen_t) -> ::ssize_t; + pub fn bind( + socket: ::c_int, + address: *const ::sockaddr, + address_len: ::socklen_t, + ) -> ::c_int; + pub fn recvfrom( + socket: ::c_int, + buf: *mut ::c_void, + len: ::size_t, + flags: ::c_int, + addr: *mut ::sockaddr, + addrlen: *mut ::socklen_t, + ) -> ::ssize_t; + + // sys/stat.h + pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; // sys/uio.h - pub fn readv(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int) -> ::ssize_t; - pub fn writev(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int) -> ::ssize_t; + pub fn readv( + fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + ) -> ::ssize_t; + pub fn writev( + fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + ) -> ::ssize_t; + + // sys/utsname.h + pub fn uname(utsname: *mut utsname) -> ::c_int; // time.h pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int; pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; } + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for dirent { + fn eq(&self, other: &dirent) -> bool { + self.d_ino == other.d_ino + && self.d_off == other.d_off + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self + .d_name + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for dirent {} + + impl ::fmt::Debug for dirent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent") + .field("d_ino", &self.d_ino) + .field("d_off", &self.d_off) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + // FIXME: .field("d_name", &self.d_name) + .finish() + } + } + + impl ::hash::Hash for dirent { + fn hash(&self, state: &mut H) { + self.d_ino.hash(state); + self.d_off.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_name.hash(state); + } + } + + impl PartialEq for sockaddr_un { + fn eq(&self, other: &sockaddr_un) -> bool { + self.sun_family == other.sun_family + && self + .sun_path + .iter() + .zip(other.sun_path.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for sockaddr_un {} + + impl ::fmt::Debug for sockaddr_un { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_un") + .field("sun_family", &self.sun_family) + // FIXME: .field("sun_path", &self.sun_path) + .finish() + } + } + + impl ::hash::Hash for sockaddr_un { + fn hash(&self, state: &mut H) { + self.sun_family.hash(state); + self.sun_path.hash(state); + } + } + + impl PartialEq for sockaddr_storage { + fn eq(&self, other: &sockaddr_storage) -> bool { + self.ss_family == other.ss_family + && self.__ss_align == self.__ss_align + && self + .__ss_padding + .iter() + .zip(other.__ss_padding.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for sockaddr_storage {} + + impl ::fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_storage") + .field("ss_family", &self.ss_family) + .field("__ss_align", &self.__ss_align) + // FIXME: .field("__ss_padding", &self.__ss_padding) + .finish() + } + } + + impl ::hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { + self.ss_family.hash(state); + self.__ss_padding.hash(state); + self.__ss_align.hash(state); + } + } + + impl PartialEq for utsname { + fn eq(&self, other: &utsname) -> bool { + self.sysname + .iter() + .zip(other.sysname.iter()) + .all(|(a, b)| a == b) + && self + .nodename + .iter() + .zip(other.nodename.iter()) + .all(|(a, b)| a == b) + && self + .release + .iter() + .zip(other.release.iter()) + .all(|(a, b)| a == b) + && self + .version + .iter() + .zip(other.version.iter()) + .all(|(a, b)| a == b) + && self + .machine + .iter() + .zip(other.machine.iter()) + .all(|(a, b)| a == b) + && self + .domainname + .iter() + .zip(other.domainname.iter()) + .all(|(a, b)| a == b) + } + } + + impl Eq for utsname {} + + impl ::fmt::Debug for utsname { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("utsname") + // FIXME: .field("sysname", &self.sysname) + // FIXME: .field("nodename", &self.nodename) + // FIXME: .field("release", &self.release) + // FIXME: .field("version", &self.version) + // FIXME: .field("machine", &self.machine) + // FIXME: .field("domainname", &self.domainname) + .finish() + } + } + + impl ::hash::Hash for utsname { + fn hash(&self, state: &mut H) { + self.sysname.hash(state); + self.nodename.hash(state); + self.release.hash(state); + self.version.hash(state); + self.machine.hash(state); + self.domainname.hash(state); + } + } + } +}