diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 964d72d1d4d99..10bd55da62685 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -204,19 +204,6 @@ jobs: export PATH=$HOME/.rust_solaris/bin:$PATH ./ci/run.sh ${{ matrix.target }} - check_cfg: - name: "Check #[cfg]s" - runs-on: ubuntu-24.04 - env: - TOOLCHAIN: nightly - timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - run: ./ci/install-rust.sh - - name: Build with check-cfg - run: LIBC_CHECK_CFG=1 cargo build -Z unstable-options -Z check-cfg - # One job that "summarizes" the success state of this pipeline. This can then be added to branch # protection, rather than having to add each job separately. success: diff --git a/Cargo.toml b/Cargo.toml index e3b20745500dd..f9c7268f60cc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,6 @@ targets = [ "armv7r-none-eabihf", # FIXME(hexagon): excluded due to duplicate symbol errors # "hexagon-unknown-linux-musl", - "i586-pc-windows-msvc", "i586-unknown-linux-gnu", "i586-unknown-linux-musl", "i686-linux-android", diff --git a/build.rs b/build.rs index 3439208f7e2ce..cf1a2e0da024b 100644 --- a/build.rs +++ b/build.rs @@ -44,7 +44,6 @@ fn main() { let (rustc_minor_ver, _is_nightly) = rustc_minor_nightly(); let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok(); let libc_ci = env::var("LIBC_CI").is_ok(); - let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok() || rustc_minor_ver >= 80; // The ABI of libc used by std is backward compatible with FreeBSD 12. // The ABI of libc from crates.io is backward compatible with FreeBSD 11. @@ -100,12 +99,9 @@ fn main() { // Set unconditionally when ctest is not being invoked. set_cfg("libc_const_extern_fn"); - // check-cfg is a nightly cargo/rustc feature to warn when unknown cfgs are used across the - // codebase. libc can configure it if the appropriate environment variable is passed. Since - // rust-lang/rust enforces it, this is useful when using a custom libc fork there. - // - // https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg - if libc_check_cfg { + // Since Rust 1.80, configuration that isn't recognized by default needs to be provided to + // avoid warnings. + if rustc_minor_ver >= 80 { for cfg in ALLOWED_CFGS { if rustc_minor_ver >= 75 { println!("cargo:rustc-check-cfg=cfg({})", cfg); diff --git a/ci/verify-build.sh b/ci/verify-build.sh index ccdc223263641..7ee562312b410 100755 --- a/ci/verify-build.sh +++ b/ci/verify-build.sh @@ -192,7 +192,6 @@ armebv7r-none-eabihf \ armv7-wrs-vxworks-eabihf \ armv7r-none-eabi \ armv7r-none-eabihf \ -i586-pc-windows-msvc \ i686-pc-windows-msvc \ i686-unknown-haiku \ i686-unknown-netbsd \ diff --git a/libc-test/build.rs b/libc-test/build.rs index 7efacf7a41e63..e02fcbe106122 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -724,7 +724,7 @@ fn test_windows(target: &str) { // Just pass all these through, no need for a "struct" prefix "FILE" | "DIR" | "Dl_info" => ty.to_string(), - // FIXME: these don't exist: + // FIXME(windows): these don't exist: "time64_t" => "__time64_t".to_string(), "ssize_t" => "SSIZE_T".to_string(), @@ -756,7 +756,7 @@ fn test_windows(target: &str) { cfg.skip_type(move |name| match name { "SSIZE_T" if !gnu => true, "ssize_t" if !gnu => true, - // FIXME: The size and alignment of this type are incorrect + // FIXME(windows): The size and alignment of this type are incorrect "time_t" if gnu && i686 => true, _ => false, }); @@ -766,7 +766,7 @@ fn test_windows(target: &str) { return true; } match ty { - // FIXME: The size and alignment of this struct are incorrect + // FIXME(windows): The size and alignment of this struct are incorrect "timespec" if gnu && i686 => true, _ => false, } @@ -774,12 +774,12 @@ fn test_windows(target: &str) { cfg.skip_const(move |name| { match name { - // FIXME: API error: + // FIXME(windows): API error: // SIG_ERR type is "void (*)(int)", not "int" "SIG_ERR" | // Similar for SIG_DFL/IGN/GET/SGE/ACK "SIG_DFL" | "SIG_IGN" | "SIG_GET" | "SIG_SGE" | "SIG_ACK" => true, - // FIXME: newer windows-gnu environment on CI? + // FIXME(windows): newer windows-gnu environment on CI? "_O_OBTAIN_DIR" if gnu => true, _ => false, } @@ -789,7 +789,7 @@ fn test_windows(target: &str) { "CONTEXT" if field == "Fp" => true, _ => false, }); - // FIXME: All functions point to the wrong addresses? + // FIXME(windows): All functions point to the wrong addresses? cfg.skip_fn_ptrcheck(|_| true); cfg.skip_signededness(move |c| { @@ -1093,7 +1093,7 @@ fn test_solarish(target: &str) { // are still ABI compatible. We can wait for the next major release // to be compliant with the new API. // - // FIXME: unskip these for next major release + // FIXME(solarish): unskip these for next major release "setpriority" | "personality" => true, // signal is defined in terms of sighandler_t, so ignore @@ -1131,7 +1131,7 @@ fn test_solarish(target: &str) { // excluded from the tests. "getifaddrs" if is_illumos => true, - // FIXME: Our API is unsound. The Rust API allows aliasing + // FIXME(ctest): Our API is unsound. The Rust API allows aliasing // pointers, but the C API requires pointers not to alias. // We should probably be at least using `&`/`&mut` here, see: // https://github.com/gnzlbg/ctest/issues/68 @@ -1277,7 +1277,7 @@ fn test_netbsd(target: &str) { return true; } match ty { - // FIXME: sighandler_t is crazy across platforms + // FIXME(netbsd): sighandler_t is crazy across platforms "sighandler_t" => true, _ => false, } @@ -1321,7 +1321,7 @@ fn test_netbsd(target: &str) { cfg.skip_fn(move |name| { match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 + // FIXME(netbsd): https://github.com/rust-lang/libc/issues/1272 "execv" | "execve" | "execvp" => true, // FIXME: netbsd 10 minimum "getentropy" | "getrandom" => true, @@ -1462,7 +1462,7 @@ fn test_dragonflybsd(target: &str) { | "Elf64_Shdr" | "Elf32_Sym" | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr" | "Elf32_Chdr" | "Elf64_Chdr" => ty.to_string(), - // FIXME: OSX calls this something else + // FIXME(dragonflybsd): OSX calls this something else "sighandler_t" => "sig_t".to_string(), t if is_union => format!("union {}", t), @@ -1507,7 +1507,7 @@ fn test_dragonflybsd(target: &str) { return true; } match ty { - // FIXME: These are tested as part of the linux_fcntl tests since + // FIXME(dragonflybsd): These are tested as part of the linux_fcntl tests since // there are header conflicts when including them with all the other // structs. "termios2" => true, @@ -1874,7 +1874,7 @@ fn test_android(target: &str) { // Our stat *_nsec fields normally don't actually exist but are part // of a timeval struct s if s.ends_with("_nsec") && struct_.starts_with("stat") => s.to_string(), - // FIXME: appears that `epoll_event.data` is an union + // FIXME(union): appears that `epoll_event.data` is an union "u64" if struct_ == "epoll_event" => "data.u64".to_string(), // The following structs have a field called `type` in C, // but `type` is a Rust keyword, so these fields are translated @@ -1893,7 +1893,7 @@ fn test_android(target: &str) { cfg.skip_type(move |ty| { match ty { - // FIXME: `sighandler_t` type is incorrect, see: + // FIXME(android): `sighandler_t` type is incorrect, see: // https://github.com/rust-lang/libc/issues/1359 "sighandler_t" => true, @@ -1904,8 +1904,10 @@ fn test_android(target: &str) { "posix_spawn_file_actions_t" => true, "posix_spawnattr_t" => true, - // FIXME: "'__uint128' undeclared" in C + // FIXME(android): "'__uint128' undeclared" in C "__uint128" => true, + // Added in API level 24 + "if_nameindex" => true, _ => false, } @@ -1927,12 +1929,12 @@ fn test_android(target: &str) { // These are tested in the `linux_elf.rs` file. "Elf64_Phdr" | "Elf32_Phdr" => true, - // FIXME: The type of `iv` has been changed. + // FIXME(android): The type of `iv` has been changed. "af_alg_iv" => true, - // FIXME: The size of struct has been changed: + // FIXME(android): The size of struct has been changed: "inotify_event" => true, - // FIXME: The field has been changed: + // FIXME(android): The field has been changed: "sockaddr_vm" => true, _ => false, @@ -1959,13 +1961,13 @@ fn test_android(target: &str) { // The `ARPHRD_CAN` is tested in the `linux_if_arp.rs` tests: "ARPHRD_CAN" => true, - // FIXME: deprecated: not available in any header + // FIXME(deprecated): deprecated: not available in any header // See: https://github.com/rust-lang/libc/issues/1356 "ENOATTR" => true, - // FIXME: still necessary? + // FIXME(android): still necessary? "SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true, // sighandler_t weirdness - // FIXME: deprecated - removed in glibc 2.26 + // FIXME(deprecated): deprecated - removed in glibc 2.26 "SIGUNUSED" => true, // Needs a newer Android SDK for the definition @@ -1974,7 +1976,7 @@ fn test_android(target: &str) { // Requires Linux kernel 5.6 "VMADDR_CID_LOCAL" => true, - // FIXME: conflicts with standard C headers and is tested in + // FIXME(android): conflicts with standard C headers and is tested in // `linux_termios.rs` below: "BOTHER" => true, "IBSHIFT" => true, @@ -2004,7 +2006,7 @@ fn test_android(target: &str) { // kernel 6.2 minimum "TUN_F_USO4" | "TUN_F_USO6" | "IFF_NO_CARRIER" => true, - // FIXME: NDK r22 minimum required + // FIXME(android): NDK r22 minimum required | "FDB_NOTIFY_BIT" | "FDB_NOTIFY_INACTIVE_BIT" | "IFLA_ALT_IFNAME" @@ -2017,16 +2019,16 @@ fn test_android(target: &str) { | "NFEA_DONT_REFRESH" | "NFEA_UNSPEC" => true, - // FIXME: NDK r23 minimum required + // FIXME(android): NDK r23 minimum required | "IFLA_PARENT_DEV_BUS_NAME" | "IFLA_PARENT_DEV_NAME" => true, - // FIXME: NDK r25 minimum required + // FIXME(android): NDK r25 minimum required | "IFLA_GRO_MAX_SIZE" | "NDA_FLAGS_EXT" | "NTF_EXT_MANAGED" => true, - // FIXME: NDK above r25 required + // FIXME(android): NDK above r25 required | "IFLA_ALLMULTI" | "IFLA_DEVLINK_PORT" | "IFLA_GRO_IPV4_MAX_SIZE" @@ -2040,7 +2042,7 @@ fn test_android(target: &str) { | "NTF_EXT_LOCKED" | "ALG_SET_DRBG_ENTROPY" => true, - // FIXME: Something has been changed on r26b: + // FIXME(android): Something has been changed on r26b: | "IPPROTO_MAX" | "NFNL_SUBSYS_COUNT" | "NF_NETDEV_NUMHOOKS" @@ -2048,10 +2050,10 @@ fn test_android(target: &str) { | "SW_MAX" | "SW_CNT" => true, - // FIXME: aarch64 env cannot find it: + // FIXME(android): aarch64 env cannot find it: | "PTRACE_GETREGS" | "PTRACE_SETREGS" if aarch64 => true, - // FIXME: The value has been changed on r26b: + // FIXME(android): The value has been changed on r26b: | "SYS_syscalls" if aarch64 => true, // From ``. @@ -2093,7 +2095,7 @@ fn test_android(target: &str) { cfg.skip_fn(move |name| { // skip those that are manually verified match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 + // FIXME(android): https://github.com/rust-lang/libc/issues/1272 "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true, // There are two versions of the sterror_r function, see @@ -2147,11 +2149,14 @@ fn test_android(target: &str) { // Added in API level 26, but some tests use level 24. "getdomainname" | "setdomainname" => true, - // FIXME: bad function pointers: + // FIXME(android): bad function pointers: "isalnum" | "isalpha" | "iscntrl" | "isdigit" | "isgraph" | "islower" | "isprint" | "ispunct" | "isspace" | "isupper" | "isxdigit" | "isblank" | "tolower" | "toupper" => true, + // Added in API level 24 + "if_nameindex" | "if_freenameindex" => true, + _ => false, } }); @@ -2163,12 +2168,12 @@ fn test_android(target: &str) { (struct_ == "sigevent" && field == "sigev_value") || // this one is an anonymous union (struct_ == "ff_effect" && field == "u") || - // FIXME: `sa_sigaction` has type `sighandler_t` but that type is + // FIXME(android): `sa_sigaction` has type `sighandler_t` but that type is // incorrect, see: https://github.com/rust-lang/libc/issues/1359 (struct_ == "sigaction" && field == "sa_sigaction") || // signalfd had SIGSYS fields added in Android 4.19, but CI does not have that version yet. (struct_ == "signalfd_siginfo" && field == "ssi_call_addr") || - // FIXME: Seems the type has been changed on NDK r26b + // FIXME(android): Seems the type has been changed on NDK r26b (struct_ == "flock64" && (field == "l_start" || field == "l_len")) }); @@ -2360,7 +2365,7 @@ fn test_freebsd(target: &str) { | "devstat_match_flags" | "devstat_priority" => ty.to_string(), - // FIXME: https://github.com/rust-lang/libc/issues/1273 + // FIXME(freebsd): https://github.com/rust-lang/libc/issues/1273 "sighandler_t" => "sig_t".to_string(), t if is_union => format!("union {}", t), @@ -2423,12 +2428,12 @@ fn test_freebsd(target: &str) { true } - // FIXME: These are deprecated - remove in a couple of releases. + // FIXME(deprecated): These are deprecated - remove in a couple of releases. // These constants were removed in FreeBSD 11 (svn r273250) but will // still be accepted and ignored at runtime. "MAP_RENAME" | "MAP_NORESERVE" => true, - // FIXME: These are deprecated - remove in a couple of releases. + // FIXME(deprecated): These are deprecated - remove in a couple of releases. // These constants were removed in FreeBSD 11 (svn r262489), // and they've never had any legitimate use outside of the // base system anyway. @@ -2454,7 +2459,7 @@ fn test_freebsd(target: &str) { // Removed in FreeBSD 14 (git 7ff9ae90f0b) "IFF_NOGROUP" => true, - // FIXME: These are deprecated - remove in a couple of releases. + // FIXME(deprecated): These are deprecated - remove in a couple of releases. // These symbols are not stable across OS-versions. They were // changed for FreeBSD 14 in git revisions b62848b0c3f and // 2cf7870864e. @@ -2568,7 +2573,7 @@ fn test_freebsd(target: &str) { } // Added in FreeBSD 14. - "F_KINFO" => true, // FIXME: depends how frequent freebsd 14 is updated on CI, this addition went this week only. + "F_KINFO" => true, // FIXME(freebsd): depends how frequent freebsd 14 is updated on CI, this addition went this week only. "SHM_RENAME_NOREPLACE" | "SHM_RENAME_EXCHANGE" | "SHM_LARGEPAGE_ALLOC_DEFAULT" @@ -2624,11 +2629,11 @@ fn test_freebsd(target: &str) { // Added in FreeBSD 14 "IFCAP_NV" if Some(14) > freebsd_ver => true, - // FIXME: Removed in https://reviews.freebsd.org/D38574 and https://reviews.freebsd.org/D38822 + // FIXME(freebsd): Removed in https://reviews.freebsd.org/D38574 and https://reviews.freebsd.org/D38822 // We maybe should deprecate them once a stable release ships them. "IP_BINDMULTI" | "IP_RSS_LISTEN_BUCKET" => true, - // FIXME: Removed in https://reviews.freebsd.org/D39127. + // FIXME(freebsd): Removed in https://reviews.freebsd.org/D39127. "KERN_VNODE" => true, // Added in FreeBSD 14 @@ -2651,10 +2656,10 @@ fn test_freebsd(target: &str) { true } - // FIXME: Removed in FreeBSD 15: + // FIXME(freebsd): Removed in FreeBSD 15: "LOCAL_CONNWAIT" if freebsd_ver >= Some(15) => true, - // FIXME: The values has been changed in FreeBSD 15: + // FIXME(freebsd): The values has been changed in FreeBSD 15: "CLOCK_BOOTTIME" if Some(15) <= freebsd_ver => true, // Added in FreeBSD 14.0 @@ -2662,8 +2667,8 @@ fn test_freebsd(target: &str) { // These constants may change or disappear in future OS releases, and they probably // have no legitimate use in applications anyway. - "CAP_UNUSED0_44" | "CAP_UNUSED0_57" | "CAP_UNUSED1_22" | "CAP_UNUSED1_57" | - "CAP_ALL0" | "CAP_ALL1" => true, + "CAP_UNUSED0_44" | "CAP_UNUSED0_57" | "CAP_UNUSED1_22" | "CAP_UNUSED1_57" + | "CAP_ALL0" | "CAP_ALL1" => true, _ => false, } @@ -2713,7 +2718,7 @@ fn test_freebsd(target: &str) { | "sctp_send_failed_event" | "sctp_stream_reset_event" => true, - // FIXME: Changed in FreeBSD 15 + // FIXME(freebsd): Changed in FreeBSD 15 "tcp_info" | "sockstat" if Some(15) >= freebsd_ver => true, _ => false, @@ -2732,7 +2737,7 @@ fn test_freebsd(target: &str) { // Therefore the function pointer comparison does not make sense for it. "uname" => true, - // FIXME: Our API is unsound. The Rust API allows aliasing + // FIXME(ctest): Our API is unsound. The Rust API allows aliasing // pointers, but the C API requires pointers not to alias. // We should probably be at least using `&`/`&mut` here, see: // https://github.com/gnzlbg/ctest/issues/68 @@ -2795,7 +2800,7 @@ fn test_freebsd(target: &str) { cfg.skip_field(move |struct_, field| { match (struct_, field) { - // FIXME: `sa_sigaction` has type `sighandler_t` but that type is + // FIXME(freebsd): `sa_sigaction` has type `sighandler_t` but that type is // incorrect, see: https://github.com/rust-lang/libc/issues/1359 ("sigaction", "sa_sigaction") => true, @@ -2826,7 +2831,7 @@ fn test_freebsd(target: &str) { // anonymous struct ("devstat", "dev_links") => true, - // FIXME: structs too complicated to bind for now... + // FIXME(freebsd): structs too complicated to bind for now... ("kinfo_proc", "ki_paddr") => true, ("kinfo_proc", "ki_addr") => true, ("kinfo_proc", "ki_tracep") => true, @@ -2874,7 +2879,7 @@ fn test_emscripten(target: &str) { assert!(target.contains("emscripten")); let mut cfg = ctest_cfg(); - cfg.define("_GNU_SOURCE", None); // FIXME: ?? + cfg.define("_GNU_SOURCE", None); // FIXME(emscripten): ?? headers! { cfg: "ctype.h", @@ -2990,7 +2995,7 @@ fn test_emscripten(target: &str) { cfg.skip_type(move |ty| { match ty { // sighandler_t is crazy across platforms - // FIXME: is this necessary? + // FIXME(emscripten): is this necessary? "sighandler_t" => true, // No epoll support @@ -3008,7 +3013,7 @@ fn test_emscripten(target: &str) { // This is actually a union, not a struct "sigval" => true, - // FIXME: Investigate why the test fails. + // FIXME(emscripten): Investigate why the test fails. // Skip for now to unblock CI. "pthread_condattr_t" => true, "pthread_mutexattr_t" => true, @@ -3036,11 +3041,11 @@ fn test_emscripten(target: &str) { cfg.skip_const(move |name| { match name { - // FIXME: deprecated - SIGNUNUSED was removed in glibc 2.26 + // FIXME(deprecated): deprecated - SIGNUNUSED was removed in glibc 2.26 // users should use SIGSYS instead "SIGUNUSED" => true, - // FIXME: emscripten uses different constants to constructs these + // FIXME(emscripten): emscripten uses different constants to constructs these n if n.contains("__SIZEOF_PTHREAD") => true, // No epoll support @@ -3097,7 +3102,7 @@ fn test_emscripten(target: &str) { (struct_ == "siginfo_t" && field == "_pad") || // musl names this __dummy1 but it's still there (struct_ == "glob_t" && field == "gl_flags") || - // FIXME: After musl 1.1.24, it have only one field `sched_priority`, + // FIXME(emscripten): After musl 1.1.24, it have only one field `sched_priority`, // while other fields become reserved. (struct_ == "sched_param" && [ "sched_ss_low_priority", @@ -3264,7 +3269,7 @@ fn test_neutrino(target: &str) { cfg.skip_type(move |ty| { match ty { - // FIXME: `sighandler_t` type is incorrect, see: + // FIXME(sighandler): `sighandler_t` type is incorrect, see: // https://github.com/rust-lang/libc/issues/1359 "sighandler_t" => true, @@ -3282,7 +3287,7 @@ fn test_neutrino(target: &str) { match ty { "Elf64_Phdr" | "Elf32_Phdr" => true, - // FIXME: This is actually a union, not a struct + // FIXME(union): This is actually a union, not a struct "sigval" => true, // union @@ -3316,7 +3321,7 @@ fn test_neutrino(target: &str) { // wrong signature of callback ptr "__cxa_atexit" => true, - // FIXME: Our API is unsound. The Rust API allows aliasing + // FIXME(ctest): Our API is unsound. The Rust API allows aliasing // pointers, but the C API requires pointers not to alias. // We should probably be at least using `&`/`&mut` here, see: // https://github.com/gnzlbg/ctest/issues/68 @@ -3426,7 +3431,7 @@ fn test_vxworks(target: &str) { "pathLib.h", "mqueue.h", } - // FIXME + // FIXME(vxworks) cfg.skip_const(move |name| match name { // sighandler_t weirdness "SIG_DFL" | "SIG_ERR" | "SIG_IGN" @@ -3434,7 +3439,7 @@ fn test_vxworks(target: &str) { | "RTLD_DEFAULT" => true, _ => false, }); - // FIXME + // FIXME(vxworks) cfg.skip_type(move |ty| match ty { "stat64" | "sighandler_t" | "off64_t" => true, _ => false, @@ -3457,7 +3462,7 @@ fn test_vxworks(target: &str) { t => t.to_string(), }); - // FIXME + // FIXME(vxworks) cfg.skip_fn(move |name| match name { // sigval "sigqueue" | "_sigqueue" @@ -3670,7 +3675,7 @@ fn test_linux(target: &str) { "linux/netfilter_ipv6/ip6_tables.h", "linux/netlink.h", "linux/openat2.h", - // FIXME: some items require Linux >= 5.6: + // FIXME(linux): some items require Linux >= 5.6: "linux/ptp_clock.h", "linux/ptrace.h", "linux/quota.h", @@ -3733,7 +3738,7 @@ fn test_linux(target: &str) { s if s.ends_with("_nsec") && struct_.starts_with("stat") => { s.replace("e_nsec", ".tv_nsec") } - // FIXME: epoll_event.data is actually a union in C, but in Rust + // FIXME(linux): epoll_event.data is actually a union in C, but in Rust // it is only a u64 because we only expose one field // http://man7.org/linux/man-pages/man2/epoll_wait.2.html "u64" if struct_ == "epoll_event" => "data.u64".to_string(), @@ -3753,7 +3758,7 @@ fn test_linux(target: &str) { }); cfg.skip_type(move |ty| { - // FIXME: very recent additions to musl, not yet released. + // FIXME(musl): very recent additions to musl, not yet released. // also apparently some glibc versions if ty == "Elf32_Relr" || ty == "Elf64_Relr" { return true; @@ -3762,7 +3767,7 @@ fn test_linux(target: &str) { return true; } match ty { - // FIXME: `sighandler_t` type is incorrect, see: + // FIXME(sighandler): `sighandler_t` type is incorrect, see: // https://github.com/rust-lang/libc/issues/1359 "sighandler_t" => true, @@ -3800,7 +3805,7 @@ fn test_linux(target: &str) { return true; } - // FIXME: CI has old headers + // FIXME(linux): CI has old headers if ty == "ptp_sys_offset_extended" { return true; } @@ -3810,7 +3815,7 @@ fn test_linux(target: &str) { return true; } - // FIXME: sparc64 CI has old headers + // FIXME(linux): sparc64 CI has old headers if sparc64 && (ty == "uinput_ff_erase" || ty == "uinput_abs_setup") { return true; } @@ -3833,7 +3838,7 @@ fn test_linux(target: &str) { return true; } - // FIXME: musl doesn't compile with `struct fanout_args` for unknown reasons. + // FIXME(musl): musl doesn't compile with `struct fanout_args` for unknown reasons. if musl && ty == "fanout_args" { return true; } @@ -3851,7 +3856,7 @@ fn test_linux(target: &str) { // which is absent in glibc, has to be defined. "__timeval" => true, - // FIXME: This is actually a union, not a struct + // FIXME(union): This is actually a union, not a struct "sigval" => true, // This type is tested in the `linux_termios.rs` file since there @@ -3859,13 +3864,13 @@ fn test_linux(target: &str) { // structs. "termios2" => true, - // FIXME: remove once we set minimum supported glibc version. + // FIXME(linux): remove once we set minimum supported glibc version. // ucontext_t added a new field as of glibc 2.28; our struct definition is // conservative and omits the field, but that means the size doesn't match for newer // glibcs (see https://github.com/rust-lang/libc/issues/1410) "ucontext_t" if gnu => true, - // FIXME: Somehow we cannot include headers correctly in glibc 2.30. + // FIXME(linux): Somehow we cannot include headers correctly in glibc 2.30. // So let's ignore for now and re-visit later. // Probably related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91085 "statx" => true, @@ -3885,14 +3890,14 @@ fn test_linux(target: &str) { "sctp_initmsg" | "sctp_sndrcvinfo" | "sctp_sndinfo" | "sctp_rcvinfo" | "sctp_nxtinfo" | "sctp_prinfo" | "sctp_authinfo" => true, - // FIXME: requires >= 6.1 kernel headers + // FIXME(linux): requires >= 6.1 kernel headers "canxl_frame" => true, - // FIXME: The size of `iv` has been changed since Linux v6.0 + // FIXME(linux): The size of `iv` has been changed since Linux v6.0 // https://github.com/torvalds/linux/commit/94dfc73e7cf4a31da66b8843f0b9283ddd6b8381 "af_alg_iv" => true, - // FIXME: Requires >= 5.1 kernel headers. + // FIXME(linux): Requires >= 5.1 kernel headers. // Everything that uses install-musl.sh has 4.19 kernel headers. "tls12_crypto_info_aes_gcm_256" if (aarch64 || arm || i686 || s390x || x86_64) && musl => @@ -3900,7 +3905,7 @@ fn test_linux(target: &str) { true } - // FIXME: Requires >= 5.11 kernel headers. + // FIXME(linux): Requires >= 5.11 kernel headers. // Everything that uses install-musl.sh has 4.19 kernel headers. "tls12_crypto_info_chacha20_poly1305" if (aarch64 || arm || i686 || s390x || x86_64) && musl => @@ -3908,26 +3913,26 @@ fn test_linux(target: &str) { true } - // FIXME: Requires >= 5.3 kernel headers. + // FIXME(linux): Requires >= 5.3 kernel headers. // Everything that uses install-musl.sh has 4.19 kernel headers. "xdp_options" if musl => true, - // FIXME: Requires >= 5.4 kernel headers. + // FIXME(linux): Requires >= 5.4 kernel headers. // Everything that uses install-musl.sh has 4.19 kernel headers. "xdp_ring_offset" | "xdp_mmap_offsets" if musl => true, - // FIXME: Requires >= 6.8 kernel headers. + // FIXME(linux): Requires >= 6.8 kernel headers. // A field was added in 6.8. // https://github.com/torvalds/linux/commit/341ac980eab90ac1f6c22ee9f9da83ed9604d899 // The previous version of the struct was removed in 6.11 due to a bug. // https://github.com/torvalds/linux/commit/32654bbd6313b4cfc82297e6634fa9725c3c900f "xdp_umem_reg" => true, - // FIXME: Requires >= 5.9 kernel headers. + // FIXME(linux): Requires >= 5.9 kernel headers. // Everything that uses install-musl.sh has 4.19 kernel headers. "xdp_statistics" if musl => true, - // FIXME: Requires >= 6.8 kernel headers. + // FIXME(linux): Requires >= 6.8 kernel headers. "xsk_tx_metadata" | "__c_anonymous_xsk_tx_metadata_union" | "xsk_tx_metadata_request" @@ -3951,7 +3956,7 @@ fn test_linux(target: &str) { // kernel so we can drop this and test the type once this new version is used in CI. "sched_attr" => true, - // FIXME: Requires >= 6.9 kernel headers. + // FIXME(linux): Requires >= 6.9 kernel headers. "epoll_params" => true, _ => false, @@ -3996,7 +4001,7 @@ fn test_linux(target: &str) { } } if musl { - // FIXME: Requires >= 5.0 kernel headers + // FIXME(linux): Requires >= 5.0 kernel headers if name == "SECCOMP_GET_NOTIF_SIZES" || name == "SECCOMP_FILTER_FLAG_NEW_LISTENER" || name == "SECCOMP_FILTER_FLAG_TSYNC_ESRCH" @@ -4007,11 +4012,11 @@ fn test_linux(target: &str) { { return true; } - // FIXME: Requires >= 4.20 kernel headers + // FIXME(linux): Requires >= 4.20 kernel headers if name == "PTP_SYS_OFFSET_EXTENDED" { return true; } - // FIXME: Requires >= 5.4 kernel headers + // FIXME(linux): Requires >= 5.4 kernel headers if name == "PTP_CLOCK_GETCAPS2" || name == "PTP_ENABLE_PPS2" || name == "PTP_EXTTS_REQUEST2" @@ -4024,7 +4029,7 @@ fn test_linux(target: &str) { { return true; } - // FIXME: Requires >= 5.4.1 kernel headers + // FIXME(linux): Requires >= 5.4.1 kernel headers if name.starts_with("J1939") || name.starts_with("RTEXT_FILTER_") || name.starts_with("SO_J1939") @@ -4032,7 +4037,7 @@ fn test_linux(target: &str) { { return true; } - // FIXME: Requires >= 5.10 kernel headers + // FIXME(linux): Requires >= 5.10 kernel headers if name.starts_with("MEMBARRIER_CMD_REGISTER") || name.starts_with("MEMBARRIER_CMD_PRIVATE") { @@ -4073,15 +4078,15 @@ fn test_linux(target: &str) { // because including `linux/if_arp.h` causes some conflicts: "ARPHRD_CAN" => true, - // FIXME: deprecated: not available in any header + // FIXME(deprecated): deprecated: not available in any header // See: https://github.com/rust-lang/libc/issues/1356 "ENOATTR" => true, - // FIXME: SIGUNUSED was removed in glibc 2.26 + // FIXME(deprecated): SIGUNUSED was removed in glibc 2.26 // Users should use SIGSYS instead. "SIGUNUSED" => true, - // FIXME: conflicts with glibc headers and is tested in + // FIXME(linux): conflicts with glibc headers and is tested in // `linux_termios.rs` below: | "BOTHER" | "IBSHIFT" @@ -4090,11 +4095,11 @@ fn test_linux(target: &str) { | "TCSETSW2" | "TCSETSF2" => true, - // FIXME: on musl the pthread types are defined a little differently + // FIXME(musl): on musl the pthread types are defined a little differently // - these constants are used by the glibc implementation. n if musl && n.contains("__SIZEOF_PTHREAD") => true, - // FIXME: It was extended to 4096 since glibc 2.31 (Linux 5.4). + // FIXME(linux): It was extended to 4096 since glibc 2.31 (Linux 5.4). // We should do so after a while. "SOMAXCONN" if gnu => true, @@ -4106,37 +4111,37 @@ fn test_linux(target: &str) { | "IPPROTO_ETHERNET" | "IPPROTO_MPTCP" => true, - // FIXME: Not yet implemented on sparc64 + // FIXME(linux): Not yet implemented on sparc64 "SYS_clone3" if sparc64 => true, - // FIXME: Not defined on ARM, gnueabihf, musl, PowerPC, riscv64, s390x, and sparc64. + // FIXME(linux): Not defined on ARM, gnueabihf, musl, PowerPC, riscv64, s390x, and sparc64. "SYS_memfd_secret" if arm | gnueabihf | musl | ppc | riscv64 | s390x | sparc64 => true, - // FIXME: Added in Linux 5.16 + // FIXME(linux): Added in Linux 5.16 // https://github.com/torvalds/linux/commit/039c0ec9bb77446d7ada7f55f90af9299b28ca49 "SYS_futex_waitv" => true, - // FIXME: Added in Linux 5.17 + // FIXME(linux): Added in Linux 5.17 // https://github.com/torvalds/linux/commit/c6018b4b254971863bd0ad36bb5e7d0fa0f0ddb0 "SYS_set_mempolicy_home_node" => true, - // FIXME: Added in Linux 5.18 + // FIXME(linux): Added in Linux 5.18 // https://github.com/torvalds/linux/commit/8b5413647262dda8d8d0e07e14ea1de9ac7cf0b2 "NFQA_PRIORITY" => true, - // FIXME: requires more recent kernel headers on CI + // FIXME(linux): requires more recent kernel headers on CI | "UINPUT_VERSION" | "SW_MAX" | "SW_CNT" if ppc64 || riscv64 => true, - // FIXME: requires more recent kernel headers on CI + // FIXME(linux): requires more recent kernel headers on CI | "MFD_EXEC" | "MFD_NOEXEC_SEAL" | "SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV" if sparc64 => true, - // FIXME: Not currently available in headers on ARM and musl. + // FIXME(linux): Not currently available in headers on ARM and musl. "NETLINK_GET_STRICT_CHK" if arm => true, // Skip as this signal codes and trap reasons need newer headers @@ -4196,26 +4201,26 @@ fn test_linux(target: &str) { | "CANXL_XLF" => true, - // FIXME: Parts of netfilter/nfnetlink*.h require more recent kernel headers: + // FIXME(linux): Parts of netfilter/nfnetlink*.h require more recent kernel headers: | "RTNLGRP_MCTP_IFADDR" // linux v5.17+ | "RTNLGRP_TUNNEL" // linux v5.18+ | "RTNLGRP_STATS" // linux v5.18+ => true, - // FIXME: The below is no longer const in glibc 2.34: + // FIXME(linux): The below is no longer const in glibc 2.34: // https://github.com/bminor/glibc/commit/5d98a7dae955bafa6740c26eaba9c86060ae0344 | "PTHREAD_STACK_MIN" | "SIGSTKSZ" | "MINSIGSTKSZ" if gnu => true, - // FIXME: Linux >= 5.16: + // FIXME(linux): Linux >= 5.16: // https://github.com/torvalds/linux/commit/42df6e1d221dddc0f2acf2be37e68d553ad65f96 "NF_NETDEV_EGRESS" if sparc64 => true, // value changed "NF_NETDEV_NUMHOOKS" if sparc64 => true, - // FIXME: requires Linux >= v5.8 + // FIXME(linux): requires Linux >= v5.8 "IF_LINK_MODE_TESTING" if sparc64 => true, // DIFF(main): fixed in 1.0 with e9abac9ac2 @@ -4227,7 +4232,7 @@ fn test_linux(target: &str) { // kernel 6.2 minimum "TUN_F_USO4" | "TUN_F_USO6" | "IFF_NO_CARRIER" => true, - // FIXME: Requires more recent kernel headers + // FIXME(linux): Requires more recent kernel headers | "IFLA_PARENT_DEV_NAME" // linux v5.13+ | "IFLA_PARENT_DEV_BUS_NAME" // linux v5.13+ | "IFLA_GRO_MAX_SIZE" // linux v5.16+ @@ -4240,10 +4245,10 @@ fn test_linux(target: &str) { // kernel 6.5 minimum "MOVE_MOUNT_BENEATH" => true, - // FIXME: Requires linux 6.1 + // FIXME(linux): Requires linux 6.1 "ALG_SET_KEY_BY_KEY_SERIAL" | "ALG_SET_DRBG_ENTROPY" => true, - // FIXME: Requires more recent kernel headers + // FIXME(linux): Requires more recent kernel headers | "FAN_FS_ERROR" // linux v5.16+ | "FAN_RENAME" // linux v5.17+ | "FAN_REPORT_TARGET_FID" // linux v5.17+ @@ -4271,10 +4276,10 @@ fn test_linux(target: &str) { | "FAN_EPIDFD" if musl => true, - // FIXME: Requires linux 6.5 + // FIXME(linux): Requires linux 6.5 "NFT_MSG_MAX" => true, - // FIXME: Requires >= 6.6 kernel headers. + // FIXME(linux): Requires >= 6.6 kernel headers. "XDP_USE_SG" | "XDP_PKT_CONTD" => @@ -4282,7 +4287,7 @@ fn test_linux(target: &str) { true } - // FIXME: Requires >= 6.8 kernel headers. + // FIXME(linux): Requires >= 6.8 kernel headers. "XDP_UMEM_TX_SW_CSUM" | "XDP_TXMD_FLAGS_TIMESTAMP" | "XDP_TXMD_FLAGS_CHECKSUM" @@ -4292,20 +4297,20 @@ fn test_linux(target: &str) { true } - // FIXME: Requires >= 6.11 kernel headers. + // FIXME(linux): Requires >= 6.11 kernel headers. "XDP_UMEM_TX_METADATA_LEN" => { true } - // FIXME: Requires >= 6.6 kernel headers. + // FIXME(linux): Requires >= 6.6 kernel headers. "SYS_fchmodat2" => true, - // FIXME: Requires >= 6.10 kernel headers. + // FIXME(linux): Requires >= 6.10 kernel headers. "SYS_mseal" => true, - // FIXME: seems to not be available all the time (from : + // FIXME(linux): seems to not be available all the time (from : "PF_VCPU" | "PF_IDLE" | "PF_EXITING" @@ -4334,11 +4339,11 @@ fn test_linux(target: &str) { | "PF_BLOCK_TS" | "PF_SUSPEND_TASK" => true, - // FIXME: Requires >= 6.9 kernel headers. + // FIXME(linux): Requires >= 6.9 kernel headers. "EPIOCSPARAMS" | "EPIOCGPARAMS" => true, - // FIXME: Requires >= 6.11 kernel headers. + // FIXME(linux): Requires >= 6.11 kernel headers. "MAP_DROPPABLE" => true, // FIXME(linux): Requires >= 6.2 kernel headers. @@ -4375,7 +4380,7 @@ fn test_linux(target: &str) { // test the XSI version below. "strerror_r" => true, - // FIXME: Our API is unsound. The Rust API allows aliasing + // FIXME(linux): Our API is unsound. The Rust API allows aliasing // pointers, but the C API requires pointers not to alias. // We should probably be at least using `&`/`&mut` here, see: // https://github.com/gnzlbg/ctest/issues/68 @@ -4386,10 +4391,10 @@ fn test_linux(target: &str) { // Needs glibc 2.35 or later. "posix_spawn_file_actions_addtcsetpgrp_np" if gnu && sparc64 => true, - // FIXME: Deprecated since glibc 2.30. Remove fn once upstream does. + // FIXME(linux): Deprecated since glibc 2.30. Remove fn once upstream does. "sysctl" if gnu => true, - // FIXME: It now takes c_void instead of timezone since glibc 2.31. + // FIXME(linux): It now takes c_void instead of timezone since glibc 2.31. "gettimeofday" if gnu => true, // These are all implemented as static inline functions in uclibc, so @@ -4417,7 +4422,7 @@ fn test_linux(target: &str) { // assume it's a int instead. "getnameinfo" if uclibc => true, - // FIXME: This needs musl 1.2.2 or later. + // FIXME(musl): This needs musl 1.2.2 or later. "gettid" if musl => true, // Needs glibc 2.33 or later. @@ -4453,7 +4458,7 @@ fn test_linux(target: &str) { "posix_basename" if gnu => true, "gnu_basename" if gnu => true, - // FIXME: function pointers changed since Ubuntu 23.10 + // FIXME(linux): function pointers changed since Ubuntu 23.10 "strtol" | "strtoll" | "strtoul" | "strtoull" | "fscanf" | "scanf" | "sscanf" => true, // Added in musl 1.2.5 @@ -4515,7 +4520,7 @@ fn test_linux(target: &str) { field == "ssi_syscall" || field == "ssi_call_addr" || field == "ssi_arch")) || - // FIXME: After musl 1.1.24, it have only one field `sched_priority`, + // FIXME(musl): After musl 1.1.24, it have only one field `sched_priority`, // while other fields become reserved. (struct_ == "sched_param" && [ "sched_ss_low_priority", @@ -4523,11 +4528,11 @@ fn test_linux(target: &str) { "sched_ss_init_budget", "sched_ss_max_repl", ].contains(&field) && musl) || - // FIXME: After musl 1.1.24, the type becomes `int` instead of `unsigned short`. + // FIXME(musl): After musl 1.1.24, the type becomes `int` instead of `unsigned short`. (struct_ == "ipc_perm" && field == "__seq" && aarch64_musl) || // glibc uses unnamed fields here and Rust doesn't support that yet (struct_ == "timex" && field.starts_with("__unused")) || - // FIXME: It now takes mode_t since glibc 2.31 on some targets. + // FIXME(linux): It now takes mode_t since glibc 2.31 on some targets. (struct_ == "ipc_perm" && field == "mode" && ((x86_64 || i686 || arm || riscv64) && gnu || x86_64_gnux32) ) || @@ -4574,9 +4579,9 @@ fn test_linux(target: &str) { }); cfg.skip_roundtrip(move |s| match s { - // FIXME: + // FIXME(1.0): "mcontext_t" if s390x => true, - // FIXME: This is actually a union. + // FIXME(union): This is actually a union. "fpreg_t" if s390x => true, // The test doesn't work on some env: @@ -4610,7 +4615,7 @@ fn test_linux(target: &str) { "fanotify_event_info_fid" => true, "cmsghdr" => true, - // FIXME: the call ABI of max_align_t is incorrect on these platforms: + // FIXME(linux): the call ABI of max_align_t is incorrect on these platforms: "max_align_t" if i686 || ppc64 => true, _ => false, @@ -4941,13 +4946,13 @@ fn test_haiku(target: &str) { return true; } match ty { - // FIXME: actually a union + // FIXME(union): actually a union "sigval" => true, - // FIXME: locale_t does not exist on Haiku + // FIXME(haiku): locale_t does not exist on Haiku "locale_t" => true, - // FIXME: rusage has a different layout on Haiku + // FIXME(haiku): rusage has a different layout on Haiku "rusage" => true, - // FIXME?: complains that rust aligns on 4 byte boundary, but + // FIXME(haiku): complains that rust aligns on 4 byte boundary, but // Haiku does not align it at all. "in6_addr" => true, // The d_name attribute is an array of 1 on Haiku, with the @@ -4972,7 +4977,7 @@ fn test_haiku(target: &str) { cfg.skip_type(move |ty| { match ty { - // FIXME: locale_t does not exist on Haiku + // FIXME(haiku): locale_t does not exist on Haiku "locale_t" => true, // These cause errors, to be reviewed in the future "sighandler_t" => true, @@ -4987,7 +4992,7 @@ fn test_haiku(target: &str) { cfg.skip_fn(move |name| { // skip those that are manually verified match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 + // FIXME(haiku): https://github.com/rust-lang/libc/issues/1272 "execv" | "execve" | "execvp" | "execvpe" => true, // FIXME: does not exist on haiku "open_wmemstream" => true, @@ -5013,7 +5018,7 @@ fn test_haiku(target: &str) { cfg.skip_const(move |name| { match name { - // FIXME: these constants do not exist on Haiku + // FIXME(haiku): these constants do not exist on Haiku "DT_UNKNOWN" | "DT_FIFO" | "DT_CHR" | "DT_DIR" | "DT_BLK" | "DT_REG" | "DT_LNK" | "DT_SOCK" => true, "USRQUOTA" | "GRPQUOTA" => true, @@ -5039,7 +5044,7 @@ fn test_haiku(target: &str) { cfg.skip_field(move |struct_, field| { match (struct_, field) { - // FIXME: the stat struct actually has timespec members, whereas + // FIXME(time): the stat struct actually has timespec members, whereas // the current representation has these unpacked. ("stat", "st_atime") => true, ("stat", "st_atime_nsec") => true, @@ -5069,7 +5074,7 @@ fn test_haiku(target: &str) { }); cfg.skip_roundtrip(move |s| match s { - // FIXME: for some reason the roundtrip check fails for cpu_info + // FIXME(1.0): for some reason the roundtrip check fails for cpu_info "cpu_info" => true, _ => false, }); diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index a60cd024f2040..c62b76b39a938 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -3382,7 +3382,9 @@ group hostent id_t idtype_t +if_freenameindex if_indextoname +if_nameindex if_nametoindex ifaddrs ifconf diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index 1b278d66a15b5..33f3682d36262 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -1924,6 +1924,7 @@ cpu_type_t ctime ctime_r ctl_info +devname difftime dirfd dirname diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt index c197a2edac65b..20efcf664696a 100644 --- a/libc-test/semver/dragonfly.txt +++ b/libc-test/semver/dragonfly.txt @@ -1296,6 +1296,7 @@ clock_getcpuclockid clock_getres clock_nanosleep clock_settime +closefrom cmsgcred cmsghdr cpuctl_cpuid_args_t @@ -1303,6 +1304,7 @@ cpuctl_cpuid_count_args_t cpuctl_msr_args_t cpuctl_update_args_t daemon +devname devname_r difftime dirfd diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index a5a9f9befb9d9..96b4c19b53fb7 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -1907,6 +1907,7 @@ cpuset_setid cpusetid_t daemon dallocx +devname devname_r difftime dirfd diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 2aed5d7628eae..9001de4c4ff3a 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -405,7 +405,6 @@ SOL_PPPOL2TP SOL_RAW SOL_RDS SOL_RXRPC -SOL_XDP STATX_ALL STATX_ATIME STATX_ATTR_APPEND @@ -472,31 +471,8 @@ UDF_SUPER_MAGIC UNAME26 USBDEVICE_SUPER_MAGIC USER_PROCESS -XDP_COPY -XDP_MMAP_OFFSETS -XDP_OPTIONS -XDP_OPTIONS_ZEROCOPY -XDP_PGOFF_RX_RING -XDP_PGOFF_TX_RING -XDP_PKT_CONTD -XDP_RING_NEED_WAKEUP -XDP_RX_RING -XDP_SHARED_UMEM -XDP_STATISTICS -XDP_TX_RING -XDP_UMEM_COMPLETION_RING -XDP_UMEM_FILL_RING -XDP_UMEM_PGOFF_COMPLETION_RING -XDP_UMEM_PGOFF_FILL_RING -XDP_UMEM_REG -XDP_UMEM_UNALIGNED_CHUNK_FLAG -XDP_USE_NEED_WAKEUP -XDP_USE_SG -XDP_ZEROCOPY XENFS_SUPER_MAGIC XFS_SUPER_MAGIC -XSK_UNALIGNED_BUF_ADDR_MASK -XSK_UNALIGNED_BUF_OFFSET_SHIFT _CS_GNU_LIBC_VERSION _CS_GNU_LIBPTHREAD_VERSION _CS_V6_ENV diff --git a/libc-test/semver/linux-musl.txt b/libc-test/semver/linux-musl.txt index 2223bb50059ee..d8e4918facb16 100644 --- a/libc-test/semver/linux-musl.txt +++ b/libc-test/semver/linux-musl.txt @@ -36,31 +36,7 @@ RWF_DSYNC RWF_HIPRI RWF_NOWAIT RWF_SYNC -SOL_XDP USER_PROCESS -XDP_COPY -XDP_MMAP_OFFSETS -XDP_OPTIONS -XDP_OPTIONS_ZEROCOPY -XDP_PGOFF_RX_RING -XDP_PGOFF_TX_RING -XDP_PKT_CONTD -XDP_RING_NEED_WAKEUP -XDP_RX_RING -XDP_SHARED_UMEM -XDP_STATISTICS -XDP_TX_RING -XDP_UMEM_COMPLETION_RING -XDP_UMEM_FILL_RING -XDP_UMEM_PGOFF_COMPLETION_RING -XDP_UMEM_PGOFF_FILL_RING -XDP_UMEM_REG -XDP_UMEM_UNALIGNED_CHUNK_FLAG -XDP_USE_NEED_WAKEUP -XDP_USE_SG -XDP_ZEROCOPY -XSK_UNALIGNED_BUF_ADDR_MASK -XSK_UNALIGNED_BUF_OFFSET_SHIFT _CS_V6_ENV _CS_V7_ENV adjtimex diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index c91b5034608d2..e0bca05e22be1 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -885,6 +885,11 @@ GENL_ID_CTRL GENL_MAX_ID GENL_MIN_ID GENL_NAMSIZ +GETALL +GETNCNT +GETPID +GETVAL +GETZCNT GLOB_ABORTED GLOB_APPEND GLOB_DOOFFS @@ -2744,6 +2749,12 @@ SEEK_DATA SEEK_HOLE SELFMAG SEM_FAILED +SEM_INFO +SEM_STAT +SEM_STAT_ANY +SEM_UNDO +SETALL +SETVAL SFD_CLOEXEC SFD_NONBLOCK SHM_EXEC @@ -2939,6 +2950,7 @@ SOL_TIPC SOL_TLS SOL_UDP SOL_X25 +SOL_XDP SOMAXCONN SO_BINDTODEVICE SO_BUSY_POLL @@ -3455,11 +3467,34 @@ W_EXITCODE W_STOPCODE XATTR_CREATE XATTR_REPLACE +XDP_COPY +XDP_MMAP_OFFSETS +XDP_OPTIONS +XDP_OPTIONS_ZEROCOPY +XDP_PGOFF_RX_RING +XDP_PGOFF_TX_RING +XDP_PKT_CONTD +XDP_RING_NEED_WAKEUP +XDP_RX_RING +XDP_SHARED_UMEM +XDP_STATISTICS XDP_TXMD_FLAGS_CHECKSUM XDP_TXMD_FLAGS_TIMESTAMP XDP_TX_METADATA +XDP_TX_RING +XDP_UMEM_COMPLETION_RING +XDP_UMEM_FILL_RING +XDP_UMEM_PGOFF_COMPLETION_RING +XDP_UMEM_PGOFF_FILL_RING +XDP_UMEM_REG XDP_UMEM_TX_METADATA_LEN XDP_UMEM_TX_SW_CSUM +XDP_UMEM_UNALIGNED_CHUNK_FLAG +XDP_USE_NEED_WAKEUP +XDP_USE_SG +XDP_ZEROCOPY +XSK_UNALIGNED_BUF_ADDR_MASK +XSK_UNALIGNED_BUF_OFFSET_SHIFT XTABS YESEXPR YESSTR diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index faeb32e76862e..d9e1b66c233a4 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -1252,9 +1252,11 @@ clearerr clock_getres clock_nanosleep clock_settime +closefrom cmsghdr consttime_memequal daemon +devname difftime dirfd dirname diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index e09df52bb4c1b..a340a83a92712 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -1068,8 +1068,10 @@ chroot clearerr clock_getres clock_settime +closefrom cmsghdr daemon +devname difftime dirfd dirname diff --git a/libc-test/semver/solarish.txt b/libc-test/semver/solarish.txt index f8380fd02936b..b02baab0efac2 100644 --- a/libc-test/semver/solarish.txt +++ b/libc-test/semver/solarish.txt @@ -1,10 +1,12 @@ AIO_ALLDONE AIO_CANCELED AIO_NOTCANCELED +IPV6_BOUND_IF IPV6_DONTFRAG IPV6_PKTINFO IPV6_RECVTCLASS IPV6_TCLASS +IP_BOUND_IF IP_DONTFRAG IP_PKTINFO IP_TOS diff --git a/libc-test/src/makedev.c b/libc-test/src/makedev.c index 7f99d60728bb4..62752c72ab97f 100644 --- a/libc-test/src/makedev.c +++ b/libc-test/src/makedev.c @@ -3,11 +3,19 @@ #include #endif -// Since makedev is a macro instead of a function, it isn't available to FFI. -// libc must reimplement it, which is error-prone. This file provides FFI -// access to the actual macro so it can be tested against the Rust -// reimplementation. +// Since makedev, major, minor are macros instead of functions, they aren't +// available to FFI. libc must reimplement them, which is error-prone. This +// file provides FFI access to the actual macros so they can be tested against +// the Rust reimplementation. dev_t makedev_ffi(unsigned major, unsigned minor) { return makedev(major, minor); } + +unsigned int major_ffi(dev_t dev) { + return major(dev); +} + +unsigned int minor_ffi(dev_t dev) { + return minor(dev); +} diff --git a/libc-test/test/linux_kernel_version.rs b/libc-test/test/linux_kernel_version.rs index 767b0db257a46..eadc4095bee96 100644 --- a/libc-test/test/linux_kernel_version.rs +++ b/libc-test/test/linux_kernel_version.rs @@ -1,15 +1,16 @@ //! Compare libc's KERNEL_VERSION macro against a specific kernel version. -#[cfg( - target_os = "linux", -)] +#[cfg(target_os = "linux")] mod t { use libc; #[test] fn test_kernel_version() { - unsafe { - assert_eq!(libc::KERNEL_VERSION(6, 0, 0), 393216); - } + assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 0) }, 393216); + // Check that the patch level saturates + assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 255) }, 393471); + assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 256) }, 393471); + assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 300) }, 393471); + assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, u32::MAX) }, 393471); } } diff --git a/libc-test/test/makedev.rs b/libc-test/test/makedev.rs index cb00975b9a41f..44297a2163aa2 100644 --- a/libc-test/test/makedev.rs +++ b/libc-test/test/makedev.rs @@ -1,6 +1,50 @@ -//! Compare libc's makdev function against the actual C macros, for various +//! Compare libc's makedev, major, minor functions against the actual C macros, for various //! inputs. +#[cfg(any(target_os = "solaris", target_os = "illumos"))] +mod ret { + pub type MajorRetType = libc::major_t; + pub type MinorRetType = libc::minor_t; +} + +#[cfg(any( + target_os = "linux", + target_os = "l4re", + target_os = "emscripten", + target_os = "fuchsia", + target_os = "aix", + target_os = "nto", + target_os = "hurd", + target_os = "openbsd", +))] +mod ret { + pub type MajorRetType = libc::c_uint; + pub type MinorRetType = libc::c_uint; +} + +#[cfg(any( + target_os = "android", + target_os = "dragonfly", + target_os = "netbsd", + target_os = "freebsd", +))] +mod ret { + pub type MajorRetType = libc::c_int; + pub type MinorRetType = libc::c_int; +} + +#[cfg(any( + target_os = "macos", + target_os = "ios", + target_os = "tvos", + target_os = "watchos", + target_os = "visionos" +))] +mod ret { + pub type MajorRetType = i32; + pub type MinorRetType = i32; +} + #[cfg(any( target_os = "android", target_os = "dragonfly", @@ -14,13 +58,21 @@ mod t { use libc::{self, c_uint, dev_t}; + use super::ret::*; + extern "C" { pub fn makedev_ffi(major: c_uint, minor: c_uint) -> dev_t; + pub fn major_ffi(dev: dev_t) -> c_uint; + pub fn minor_ffi(dev: dev_t) -> c_uint; } fn compare(major: c_uint, minor: c_uint) { - let expected = unsafe { makedev_ffi(major, minor) }; - assert_eq!(libc::makedev(major, minor), expected); + let dev = unsafe { makedev_ffi(major, minor) }; + assert_eq!(libc::makedev(major, minor), dev); + let major = unsafe { major_ffi(dev) }; + assert_eq!(libc::major(dev), major as MajorRetType); + let minor = unsafe { minor_ffi(dev) }; + assert_eq!(libc::minor(dev), minor as MinorRetType); } // Every OS should be able to handle 8 bit major and minor numbers diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index d666c7e39de60..9e8f55471a1ac 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -3423,20 +3423,6 @@ f! { set1.bits == set2.bits } - pub fn major(dev: crate::dev_t) -> c_uint { - let mut major = 0; - major |= (dev & 0x00000000000fff00) >> 8; - major |= (dev & 0xfffff00000000000) >> 32; - major as c_uint - } - - pub fn minor(dev: crate::dev_t) -> c_uint { - let mut minor = 0; - minor |= (dev & 0x00000000000000ff) >> 0; - minor |= (dev & 0x00000ffffff00000) >> 12; - minor as c_uint - } - pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { cmsg.offset(1) as *mut c_uchar } @@ -3519,6 +3505,20 @@ safe_f! { dev |= (minor & 0xffffff00) << 12; dev } + + pub {const} fn major(dev: crate::dev_t) -> c_uint { + let mut major = 0; + major |= (dev & 0x00000000000fff00) >> 8; + major |= (dev & 0xfffff00000000000) >> 32; + major as c_uint + } + + pub {const} fn minor(dev: crate::dev_t) -> c_uint { + let mut minor = 0; + minor |= (dev & 0x00000000000000ff) >> 0; + minor |= (dev & 0x00000ffffff00000) >> 12; + minor as c_uint + } } fn __CMSG_LEN(cmsg: *const cmsghdr) -> ssize_t { diff --git a/src/fuchsia/x86_64.rs b/src/fuchsia/x86_64.rs index ffff3a78b5ed5..a184539e28277 100644 --- a/src/fuchsia/x86_64.rs +++ b/src/fuchsia/x86_64.rs @@ -102,7 +102,7 @@ cfg_if! { .field("uc_stack", &self.uc_stack) .field("uc_mcontext", &self.uc_mcontext) .field("uc_sigmask", &self.uc_sigmask) - // FIXME: .field("__private", &self.__private) + // FIXME(debug): .field("__private", &self.__private) .finish() } } diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 647836b6f6719..a43fcd104748c 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -533,20 +533,15 @@ s! { pub it_interval: crate::timespec, pub it_value: crate::timespec, } -} - -s_no_extra_traits! { - pub union __sigaction_sa_union { - pub __su_handler: extern "C" fn(c: c_int), - pub __su_sigaction: extern "C" fn(c: c_int, info: *mut siginfo_t, ptr: *mut c_void), - } pub struct sigaction { - pub sa_union: __sigaction_sa_union, + pub sa_sigaction: crate::sighandler_t, // FIXME(union): this field is actually a union pub sa_mask: sigset_t, pub sa_flags: c_int, } +} +s_no_extra_traits! { pub union __poll_ctl_ext_u { pub addr: *mut c_void, pub data32: u32, @@ -565,49 +560,6 @@ s_no_extra_traits! { cfg_if! { if #[cfg(feature = "extra_traits")] { - impl PartialEq for __sigaction_sa_union { - fn eq(&self, other: &__sigaction_sa_union) -> bool { - unsafe { - self.__su_handler == other.__su_handler - && self.__su_sigaction == other.__su_sigaction - } - } - } - impl Eq for __sigaction_sa_union {} - impl hash::Hash for __sigaction_sa_union { - fn hash(&self, state: &mut H) { - unsafe { - self.__su_handler.hash(state); - self.__su_sigaction.hash(state); - } - } - } - - impl PartialEq for sigaction { - fn eq(&self, other: &sigaction) -> bool { - self.sa_mask == other.sa_mask - && self.sa_flags == other.sa_flags - && self.sa_union == other.sa_union - } - } - impl Eq for sigaction {} - impl fmt::Debug for sigaction { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("sigaction") - .field("sa_union", &self.sa_union) - .field("sa_mask", &self.sa_mask) - .field("sa_flags", &self.sa_flags) - .finish() - } - } - impl hash::Hash for sigaction { - fn hash(&self, state: &mut H) { - self.sa_union.hash(state); - self.sa_mask.hash(state); - self.sa_flags.hash(state); - } - } - impl PartialEq for __poll_ctl_ext_u { fn eq(&self, other: &__poll_ctl_ext_u) -> bool { unsafe { @@ -2546,25 +2498,6 @@ f! { let fd = fd as usize; return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0; } - - pub fn major(dev: crate::dev_t) -> c_uint { - let x = dev >> 16; - x as c_uint - } - - pub fn minor(dev: crate::dev_t) -> c_uint { - let y = dev & 0xFFFF; - y as c_uint - } - - pub fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { - let major = major as crate::dev_t; - let minor = minor as crate::dev_t; - let mut dev = 0; - dev |= major << 16; - dev |= minor; - dev - } } safe_f! { @@ -2612,6 +2545,25 @@ safe_f! { pub {const} fn WCOREDUMP(_status: c_int) -> bool { false } + + pub {const} fn major(dev: crate::dev_t) -> c_uint { + let x = dev >> 16; + x as c_uint + } + + pub {const} fn minor(dev: crate::dev_t) -> c_uint { + let y = dev & 0xFFFF; + y as c_uint + } + + pub {const} fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { + let major = major as crate::dev_t; + let minor = minor as crate::dev_t; + let mut dev = 0; + dev |= major << 16; + dev |= minor; + dev + } } #[link(name = "thread")] diff --git a/src/unix/bsd/apple/b32/mod.rs b/src/unix/bsd/apple/b32/mod.rs index 4fec58f76be47..3753ffb085907 100644 --- a/src/unix/bsd/apple/b32/mod.rs +++ b/src/unix/bsd/apple/b32/mod.rs @@ -45,7 +45,7 @@ s! { } pub struct malloc_zone_t { - __private: [crate::uintptr_t; 18], // FIXME: keeping private for now + __private: [crate::uintptr_t; 18], // FIXME(macos): keeping private for now } } @@ -84,7 +84,7 @@ cfg_if! { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_attr_t") .field("__sig", &self.__sig) - // FIXME: .field("__opaque", &self.__opaque) + // FIXME(debug): .field("__opaque", &self.__opaque) .finish() } } diff --git a/src/unix/bsd/apple/b64/aarch64/mod.rs b/src/unix/bsd/apple/b64/aarch64/mod.rs index 60b9d4bb4ce40..e300b76ae8228 100644 --- a/src/unix/bsd/apple/b64/aarch64/mod.rs +++ b/src/unix/bsd/apple/b64/aarch64/mod.rs @@ -5,7 +5,7 @@ pub type mcontext_t = *mut __darwin_mcontext64; s! { pub struct malloc_zone_t { - __private: [crate::uintptr_t; 18], // FIXME: needs arm64 auth pointers support + __private: [crate::uintptr_t; 18], // FIXME(macos): needs arm64 auth pointers support } pub struct ucontext_t { diff --git a/src/unix/bsd/apple/b64/mod.rs b/src/unix/bsd/apple/b64/mod.rs index 98dccd3d49ddd..2bd682313428e 100644 --- a/src/unix/bsd/apple/b64/mod.rs +++ b/src/unix/bsd/apple/b64/mod.rs @@ -77,7 +77,7 @@ cfg_if! { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_attr_t") .field("__sig", &self.__sig) - // FIXME: .field("__opaque", &self.__opaque) + // FIXME(debug): .field("__opaque", &self.__opaque) .finish() } } diff --git a/src/unix/bsd/apple/b64/x86_64/mod.rs b/src/unix/bsd/apple/b64/x86_64/mod.rs index ea738497e98de..aa5ab85c0268b 100644 --- a/src/unix/bsd/apple/b64/x86_64/mod.rs +++ b/src/unix/bsd/apple/b64/x86_64/mod.rs @@ -106,7 +106,7 @@ s! { } pub struct malloc_introspection_t { - _private: [crate::uintptr_t; 16], // FIXME: keeping private for now + _private: [crate::uintptr_t; 16], // FIXME(macos): keeping private for now } pub struct malloc_zone_t { diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index fe8bad4209f37..9103522d95053 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -371,7 +371,7 @@ s! { } pub struct sigaction { - // FIXME: this field is actually a union + // FIXME(union): this field is actually a union pub sa_sigaction: crate::sighandler_t, pub sa_mask: sigset_t, pub sa_flags: c_int, @@ -1342,9 +1342,9 @@ s_no_extra_traits! { pub shm_lpid: crate::pid_t, pub shm_cpid: crate::pid_t, pub shm_nattch: crate::shmatt_t, - pub shm_atime: crate::time_t, // FIXME: 64-bit wrong align => wrong offset - pub shm_dtime: crate::time_t, // FIXME: 64-bit wrong align => wrong offset - pub shm_ctime: crate::time_t, // FIXME: 64-bit wrong align => wrong offset + pub shm_atime: crate::time_t, // FIXME(macos): 64-bit wrong align => wrong offset + pub shm_dtime: crate::time_t, // FIXME(macos): 64-bit wrong align => wrong offset + pub shm_ctime: crate::time_t, // FIXME(macos): 64-bit wrong align => wrong offset // FIXME: 64-bit wrong align => wrong offset: pub shm_internal: *mut c_void, } @@ -1955,7 +1955,7 @@ cfg_if! { .field("pth_curpri", &self.pth_curpri) .field("pth_priority", &self.pth_priority) .field("pth_maxpriority", &self.pth_maxpriority) - // FIXME: .field("pth_name", &self.pth_name) + // FIXME(debug): .field("pth_name", &self.pth_name) .finish() } } @@ -2021,8 +2021,8 @@ cfg_if! { .field("f_fssubtype", &self.f_fssubtype) .field("f_fstypename", &self.f_fstypename) .field("f_type", &self.f_type) - // FIXME: .field("f_mntonname", &self.f_mntonname) - // FIXME: .field("f_mntfromname", &self.f_mntfromname) + // FIXME(debug): .field("f_mntonname", &self.f_mntonname) + // FIXME(debug): .field("f_mntfromname", &self.f_mntfromname) .field("f_reserved", &self.f_reserved) .finish() } @@ -2072,7 +2072,7 @@ cfg_if! { .field("d_reclen", &self.d_reclen) .field("d_namlen", &self.d_namlen) .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) + // FIXME(debug): .field("d_name", &self.d_name) .finish() } } @@ -2101,7 +2101,7 @@ cfg_if! { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_rwlock_t") .field("__sig", &self.__sig) - // FIXME: .field("__opaque", &self.__opaque) + // FIXME(debug): .field("__opaque", &self.__opaque) .finish() } } @@ -2129,7 +2129,7 @@ cfg_if! { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_mutex_t") .field("__sig", &self.__sig) - // FIXME: .field("__opaque", &self.__opaque) + // FIXME(debug): .field("__opaque", &self.__opaque) .finish() } } @@ -2158,7 +2158,7 @@ cfg_if! { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("pthread_cond_t") .field("__sig", &self.__sig) - // FIXME: .field("__opaque", &self.__opaque) + // FIXME(debug): .field("__opaque", &self.__opaque) .finish() } } @@ -2197,7 +2197,7 @@ cfg_if! { .field("ss_family", &self.ss_family) .field("__ss_pad1", &self.__ss_pad1) .field("__ss_align", &self.__ss_align) - // FIXME: .field("__ss_pad2", &self.__ss_pad2) + // FIXME(debug): .field("__ss_pad2", &self.__ss_pad2) .finish() } } @@ -2237,13 +2237,13 @@ cfg_if! { impl fmt::Debug for utmpx { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmpx") - // FIXME: .field("ut_user", &self.ut_user) + // FIXME(debug): .field("ut_user", &self.ut_user) .field("ut_id", &self.ut_id) .field("ut_line", &self.ut_line) .field("ut_pid", &self.ut_pid) .field("ut_type", &self.ut_type) .field("ut_tv", &self.ut_tv) - // FIXME: .field("ut_host", &self.ut_host) + // FIXME(debug): .field("ut_host", &self.ut_host) .field("ut_pad", &self.ut_pad) .finish() } @@ -2485,7 +2485,7 @@ cfg_if! { .field("pth_curpri", &self.pth_curpri) .field("pth_priority", &self.pth_priority) .field("pth_maxpriority", &self.pth_maxpriority) - // FIXME: .field("pth_name", &self.pth_name) + // FIXME(debug): .field("pth_name", &self.pth_name) .finish() } } @@ -5715,18 +5715,6 @@ f! { pub {const} fn VM_MAKE_TAG(id: u8) -> u32 { (id as u32) << 24u32 } - - pub fn major(dev: dev_t) -> i32 { - (dev >> 24) & 0xff - } - - pub fn minor(dev: dev_t) -> i32 { - dev & 0xffffff - } - - pub fn makedev(major: i32, minor: i32) -> dev_t { - (major << 24) | minor - } } safe_f! { @@ -5749,6 +5737,18 @@ safe_f! { pub {const} fn WIFSTOPPED(status: c_int) -> bool { _WSTATUS(status) == _WSTOPPED && WSTOPSIG(status) != 0x13 } + + pub {const} fn makedev(major: i32, minor: i32) -> dev_t { + (major << 24) | minor + } + + pub {const} fn major(dev: dev_t) -> i32 { + (dev >> 24) & 0xff + } + + pub {const} fn minor(dev: dev_t) -> i32 { + dev & 0xffffff + } } extern "C" { diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index cfaa93f76d88e..5dbe69e564b33 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -560,7 +560,7 @@ cfg_if! { .field("ut_name", &self.ut_name) .field("ut_id", &self.ut_id) .field("ut_line", &self.ut_line) - // FIXME: .field("ut_host", &self.ut_host) + // FIXME(debug): .field("ut_host", &self.ut_host) .field("ut_unused", &self.ut_unused) .field("ut_session", &self.ut_session) .field("ut_type", &self.ut_type) @@ -639,7 +639,7 @@ cfg_if! { .field("d_type", &self.d_type) // Ignore __unused1 // Ignore __unused2 - // FIXME: .field("d_name", &self.d_name) + // FIXME(debug): .field("d_name", &self.d_name) .finish() } } @@ -701,10 +701,10 @@ cfg_if! { .field("f_flags", &self.f_flags) .field("f_syncwrites", &self.f_syncwrites) .field("f_asyncwrites", &self.f_asyncwrites) - // FIXME: .field("f_mntonname", &self.f_mntonname) + // FIXME(debug): .field("f_mntonname", &self.f_mntonname) .field("f_syncreads", &self.f_syncreads) .field("f_asyncreads", &self.f_asyncreads) - // FIXME: .field("f_mntfromname", &self.f_mntfromname) + // FIXME(debug): .field("f_mntfromname", &self.f_mntfromname) .finish() } } @@ -1590,14 +1590,6 @@ f! { let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); 0 != cpuset.ary[idx] & (1 << offset) } - - pub fn major(dev: crate::dev_t) -> c_int { - ((dev >> 8) & 0xff) as c_int - } - - pub fn minor(dev: crate::dev_t) -> c_int { - (dev & 0xffff00ff) as c_int - } } safe_f! { @@ -1613,6 +1605,14 @@ safe_f! { dev |= minor; dev } + + pub {const} fn major(dev: crate::dev_t) -> c_int { + ((dev >> 8) & 0xff) as c_int + } + + pub {const} fn minor(dev: crate::dev_t) -> c_int { + (dev & 0xffff00ff) as c_int + } } extern "C" { @@ -1702,6 +1702,8 @@ extern "C" { mntvbufp: *mut *mut crate::statvfs, flags: c_int, ) -> c_int; + + pub fn closefrom(lowfd: c_int) -> c_int; } #[link(name = "rt")] diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs index 6a484e4a0b229..87ddbcc4376c8 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs @@ -441,14 +441,12 @@ safe_f! { let minor = minor as crate::dev_t; (major << 8) | minor } -} -f! { - pub fn major(dev: crate::dev_t) -> c_int { + pub {const} fn major(dev: crate::dev_t) -> c_int { ((dev >> 8) & 0xff) as c_int } - pub fn minor(dev: crate::dev_t) -> c_int { + pub {const} fn minor(dev: crate::dev_t) -> c_int { (dev & 0xffff00ff) as c_int } } diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index d419433efeb9b..6c2f586195dc5 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -496,14 +496,12 @@ safe_f! { dev |= ((minor & 0xffff00ff) as dev_t) << 0; dev } -} -f! { - pub fn major(dev: crate::dev_t) -> c_int { + pub {const} fn major(dev: crate::dev_t) -> c_int { (((dev >> 32) & 0xffffff00) | ((dev >> 8) & 0xff)) as c_int } - pub fn minor(dev: crate::dev_t) -> c_int { + pub {const} fn minor(dev: crate::dev_t) -> c_int { (((dev >> 24) & 0xff00) | (dev & 0xffff00ff)) as c_int } } diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs index c5944a69988e8..cf507e66b38c0 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs @@ -518,14 +518,12 @@ safe_f! { dev |= ((minor & 0xffff00ff) as dev_t) << 0; dev } -} -f! { - pub fn major(dev: crate::dev_t) -> c_int { + pub {const} fn major(dev: crate::dev_t) -> c_int { (((dev >> 32) & 0xffffff00) | ((dev >> 8) & 0xff)) as c_int } - pub fn minor(dev: crate::dev_t) -> c_int { + pub {const} fn minor(dev: crate::dev_t) -> c_int { (((dev >> 24) & 0xff00) | (dev & 0xffff00ff)) as c_int } } diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs index 34dd48f486f4a..0a05ca9fad3e8 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs @@ -518,14 +518,12 @@ safe_f! { dev |= ((minor & 0xffff00ff) as dev_t) << 0; dev } -} -f! { - pub fn major(dev: crate::dev_t) -> c_int { + pub {const} fn major(dev: crate::dev_t) -> c_int { (((dev >> 32) & 0xffffff00) | ((dev >> 8) & 0xff)) as c_int } - pub fn minor(dev: crate::dev_t) -> c_int { + pub {const} fn minor(dev: crate::dev_t) -> c_int { (((dev >> 24) & 0xff00) | (dev & 0xffff00ff)) as c_int } } diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs index 9c81a8410db04..2fe39a3acea2c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs @@ -519,14 +519,12 @@ safe_f! { dev |= ((minor & 0xffff00ff) as dev_t) << 0; dev } -} -f! { - pub fn major(dev: crate::dev_t) -> c_int { + pub {const} fn major(dev: crate::dev_t) -> c_int { (((dev >> 32) & 0xffffff00) | ((dev >> 8) & 0xff)) as c_int } - pub fn minor(dev: crate::dev_t) -> c_int { + pub {const} fn minor(dev: crate::dev_t) -> c_int { (((dev >> 24) & 0xff00) | (dev & 0xffff00ff)) as c_int } } diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 23bbb1e1c47fe..824ff1ac674c6 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -1639,7 +1639,7 @@ s_no_extra_traits! { pub kf_flags: c_int, _kf_pad0: c_int, pub kf_offset: i64, - _priv: [u8; 304], // FIXME: this is really a giant union + _priv: [u8; 304], // FIXME(freebsd): this is really a giant union pub kf_status: u16, _kf_pad1: u16, _kf_ispare0: c_int, @@ -1690,8 +1690,8 @@ cfg_if! { .field("ut_pid", &self.ut_pid) .field("ut_user", &self.ut_user) .field("ut_line", &self.ut_line) - // FIXME: .field("ut_host", &self.ut_host) - // FIXME: .field("__ut_spare", &self.__ut_spare) + // FIXME(debug): .field("ut_host", &self.ut_host) + // FIXME(debug): .field("__ut_spare", &self.__ut_spare) .finish() } } @@ -1778,7 +1778,7 @@ cfg_if! { .field("sdl_nlen", &self.sdl_nlen) .field("sdl_alen", &self.sdl_alen) .field("sdl_slen", &self.sdl_slen) - // FIXME: .field("sdl_data", &self.sdl_data) + // FIXME(debug): .field("sdl_data", &self.sdl_data) .finish() } } @@ -2286,7 +2286,7 @@ cfg_if! { f.debug_struct("sctp_gen_error_cause") .field("code", &{ self.code }) .field("length", &{ self.length }) - // FIXME: .field("info", &{self.info}) + // FIXME(debug): .field("info", &{self.info}) .finish() } } @@ -2358,7 +2358,7 @@ cfg_if! { f.debug_struct("sctp_error_missing_param") .field("cause", &{ self.cause }) .field("num_missing_params", &{ self.num_missing_params }) - // FIXME: .field("tpe", &{self.tpe}) + // FIXME(debug): .field("tpe", &{self.tpe}) .finish() } } @@ -5689,7 +5689,7 @@ extern "C" { pub fn pidfile_close(path: *mut crate::pidfh) -> c_int; pub fn pidfile_remove(path: *mut crate::pidfh) -> c_int; pub fn pidfile_fileno(path: *const crate::pidfh) -> c_int; - // FIXME: pidfile_signal in due time (both manpage present and updated image snapshot) + // FIXME(freebsd): pidfile_signal in due time (both manpage present and updated image snapshot) } #[link(name = "procstat")] diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index fde274bb15a69..065847043225c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -344,7 +344,7 @@ cfg_if! { .field("mc_len", &self.mc_len) .field("mc_fpformat", &self.mc_fpformat) .field("mc_ownedfp", &self.mc_ownedfp) - // FIXME: .field("mc_fpstate", &self.mc_fpstate) + // FIXME(debug): .field("mc_fpstate", &self.mc_fpstate) .field("mc_fsbase", &self.mc_fsbase) .field("mc_gsbase", &self.mc_gsbase) .field("mc_xfpustate", &self.mc_xfpustate) diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 3c62e7d5e8271..2d74756d9957d 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -418,7 +418,7 @@ cfg_if! { .field("ss_family", &self.ss_family) .field("__ss_pad1", &self.__ss_pad1) .field("__ss_align", &self.__ss_align) - // FIXME: .field("__ss_pad2", &self.__ss_pad2) + // FIXME(debug): .field("__ss_pad2", &self.__ss_pad2) .finish() } } diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 445957537eb76..674fdc088d2b9 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -185,7 +185,7 @@ cfg_if! { f.debug_struct("sockaddr_un") .field("sun_len", &self.sun_len) .field("sun_family", &self.sun_family) - // FIXME: .field("sun_path", &self.sun_path) + // FIXME(debug): .field("sun_path", &self.sun_path) .finish() } } @@ -232,11 +232,11 @@ cfg_if! { 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(debug): .field("sysname", &self.sysname) + // FIXME(debug): .field("nodename", &self.nodename) + // FIXME(debug): .field("release", &self.release) + // FIXME(debug): .field("version", &self.version) + // FIXME(debug): .field("machine", &self.machine) .finish() } } @@ -965,6 +965,8 @@ extern "C" { timeptr: *const crate::tm, locale: crate::locale_t, ) -> size_t; + + pub fn devname(dev: crate::dev_t, mode_t: crate::mode_t) -> *mut c_char; } cfg_if! { diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index 7e5fa2ca87ef5..dfd58d75b74ae 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -861,6 +861,8 @@ extern "C" { flags: c_int, timeout: *mut crate::timespec, ) -> c_int; + + pub fn closefrom(lowfd: c_int) -> c_int; } cfg_if! { diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index fe2b667a523fc..8ede2b603d100 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -10,7 +10,7 @@ pub type fsfilcnt_t = u64; pub type idtype_t = c_int; pub type mqd_t = c_int; type __pthread_spin_t = __cpu_simple_lock_nv_t; -pub type vm_size_t = crate::uintptr_t; // FIXME: deprecated since long time +pub type vm_size_t = crate::uintptr_t; // FIXME(deprecated): deprecated since long time pub type lwpid_t = c_uint; pub type shmatt_t = c_uint; pub type cpuid_t = c_ulong; @@ -297,7 +297,8 @@ s! { pub flags: u32, pub fflags: u32, pub data: i64, - pub udata: intptr_t, /* FIXME: NetBSD 10.0 will finally have same layout as other BSD */ + // FIXME(netbsd): NetBSD 10.0 will finally have same layout as other BSD + pub udata: intptr_t, } pub struct dqblk { @@ -799,7 +800,7 @@ s_no_extra_traits! { pub ut_session: u16, pub ut_type: u16, pub ut_pid: crate::pid_t, - pub ut_exit: __exit_status, // FIXME: when anonymous struct are supported + pub ut_exit: __exit_status, // FIXME(netbsd): when anonymous struct are supported pub ut_ss: sockaddr_storage, pub ut_tv: crate::timeval, pub ut_pad: [u8; _UTX_PADSIZE], @@ -945,14 +946,14 @@ cfg_if! { .field("ut_name", &self.ut_name) .field("ut_id", &self.ut_id) .field("ut_line", &self.ut_line) - // FIXME .field("ut_host", &self.ut_host) + // FIXME(debug) .field("ut_host", &self.ut_host) .field("ut_session", &self.ut_session) .field("ut_type", &self.ut_type) .field("ut_pid", &self.ut_pid) .field("ut_exit", &self.ut_exit) .field("ut_ss", &self.ut_ss) .field("ut_tv", &self.ut_tv) - // FIXME .field("ut_pad", &self.ut_pad) + // FIXME(debug) .field("ut_pad", &self.ut_pad) .finish() } } @@ -993,7 +994,7 @@ cfg_if! { f.debug_struct("lastlogx") .field("ll_tv", &self.ll_tv) .field("ll_line", &self.ll_line) - // FIXME.field("ll_host", &self.ll_host) + // FIXME(debug).field("ll_host", &self.ll_host) .field("ll_ss", &self.ll_ss) .finish() } @@ -1159,7 +1160,7 @@ cfg_if! { .field("d_reclen", &self.d_reclen) .field("d_namlen", &self.d_namlen) .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) + // FIXME(debug): .field("d_name", &self.d_name) .finish() } } @@ -1235,8 +1236,8 @@ cfg_if! { .field("f_owner", &self.f_owner) .field("f_spare", &self.f_spare) .field("f_fstypename", &self.f_fstypename) - // FIXME: .field("f_mntonname", &self.f_mntonname) - // FIXME: .field("f_mntfromname", &self.f_mntfromname) + // FIXME(debug): .field("f_mntonname", &self.f_mntonname) + // FIXME(debug): .field("f_mntfromname", &self.f_mntfromname) .finish() } } @@ -1290,7 +1291,7 @@ cfg_if! { .field("ss_family", &self.ss_family) .field("__ss_pad1", &self.__ss_pad1) .field("__ss_pad2", &self.__ss_pad2) - // FIXME: .field("__ss_pad3", &self.__ss_pad3) + // FIXME(debug): .field("__ss_pad3", &self.__ss_pad3) .finish() } } @@ -2460,17 +2461,6 @@ f! { pub fn PROT_MPROTECT_EXTRACT(x: c_int) -> c_int { (x >> 3) & 0x7 } - - pub fn major(dev: crate::dev_t) -> c_int { - (((dev as u32) & 0x000fff00) >> 8) as c_int - } - - pub fn minor(dev: crate::dev_t) -> c_int { - let mut res = 0; - res |= ((dev as u32) & 0xfff00000) >> 12; - res |= (dev as u32) & 0x000000ff; - res as c_int - } } safe_f! { @@ -2499,6 +2489,17 @@ safe_f! { dev |= minor & 0xff; dev } + + pub {const} fn major(dev: crate::dev_t) -> c_int { + (((dev as u32) & 0x000fff00) >> 8) as c_int + } + + pub {const} fn minor(dev: crate::dev_t) -> c_int { + let mut res = 0; + res |= ((dev as u32) & 0xfff00000) >> 12; + res |= (dev as u32) & 0x000000ff; + res as c_int + } } extern "C" { diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index f86919264c0ad..ff3a99fcc7db2 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -781,7 +781,7 @@ cfg_if! { .field("d_reclen", &self.d_reclen) .field("d_type", &self.d_type) .field("d_namlen", &self.d_namlen) - // FIXME: .field("d_name", &self.d_name) + // FIXME(debug): .field("d_name", &self.d_name) .finish() } } @@ -874,8 +874,8 @@ cfg_if! { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("lastlog") .field("ll_time", &self.ll_time) - // FIXME: .field("ll_line", &self.ll_line) - // FIXME: .field("ll_host", &self.ll_host) + // FIXME(debug): .field("ll_line", &self.ll_line) + // FIXME(debug): .field("ll_host", &self.ll_host) .finish() } } @@ -914,9 +914,9 @@ cfg_if! { impl fmt::Debug for utmp { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("utmp") - // FIXME: .field("ut_line", &self.ut_line) - // FIXME: .field("ut_name", &self.ut_name) - // FIXME: .field("ut_host", &self.ut_host) + // FIXME(debug): .field("ut_line", &self.ut_line) + // FIXME(debug): .field("ut_name", &self.ut_name) + // FIXME(debug): .field("ut_host", &self.ut_host) .field("ut_time", &self.ut_time) .finish() } @@ -1049,10 +1049,10 @@ cfg_if! { .field("f_namemax", &self.f_namemax) .field("f_owner", &self.f_owner) .field("f_ctime", &self.f_ctime) - // FIXME: .field("f_fstypename", &self.f_fstypename) - // FIXME: .field("f_mntonname", &self.f_mntonname) - // FIXME: .field("f_mntfromname", &self.f_mntfromname) - // FIXME: .field("f_mntfromspec", &self.f_mntfromspec) + // FIXME(debug): .field("f_fstypename", &self.f_fstypename) + // FIXME(debug): .field("f_mntonname", &self.f_mntonname) + // FIXME(debug): .field("f_mntfromname", &self.f_mntfromname) + // FIXME(debug): .field("f_mntfromspec", &self.f_mntfromspec) .field("mount_info", &self.mount_info) .finish() } @@ -1966,19 +1966,6 @@ f! { pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { (_ALIGN(mem::size_of::()) + _ALIGN(length as usize)) as c_uint } - - pub fn major(dev: crate::dev_t) -> c_uint { - ((dev as c_uint) >> 8) & 0xff - } - - pub fn minor(dev: crate::dev_t) -> c_uint { - let dev = dev as c_uint; - let mut res = 0; - res |= (dev) & 0xff; - res |= ((dev) & 0xffff0000) >> 8; - - res - } } safe_f! { @@ -2007,6 +1994,18 @@ safe_f! { dev |= (minor & 0xffff00) << 8; dev } + + pub {const} fn major(dev: crate::dev_t) -> c_uint { + ((dev as c_uint) >> 8) & 0xff + } + + pub {const} fn minor(dev: crate::dev_t) -> c_uint { + let dev = dev as c_uint; + let mut res = 0; + res |= (dev) & 0xff; + res |= ((dev) & 0xffff0000) >> 8; + res + } } extern "C" { diff --git a/src/unix/bsd/netbsdlike/openbsd/x86_64.rs b/src/unix/bsd/netbsdlike/openbsd/x86_64.rs index db9114e27cb60..9003f3588c1b6 100644 --- a/src/unix/bsd/netbsdlike/openbsd/x86_64.rs +++ b/src/unix/bsd/netbsdlike/openbsd/x86_64.rs @@ -92,8 +92,8 @@ cfg_if! { .field("fx_rdp", &{ self.fx_rdp }) .field("fx_mxcsr", &{ self.fx_mxcsr }) .field("fx_mxcsr_mask", &{ self.fx_mxcsr_mask }) - // FIXME: .field("fx_st", &{self.fx_st}) - // FIXME: .field("fx_xmm", &{self.fx_xmm}) + // FIXME(debug): .field("fx_st", &{self.fx_st}) + // FIXME(debug): .field("fx_xmm", &{self.fx_xmm}) .finish() } } diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index 10ee719b9c18f..76e44cc796f1d 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -562,7 +562,7 @@ cfg_if! { f.debug_struct("sockaddr_un") .field("sun_len", &self.sun_len) .field("sun_family", &self.sun_family) - // FIXME: .field("sun_path", &self.sun_path) + // FIXME(debug): .field("sun_path", &self.sun_path) .finish() } } @@ -599,7 +599,7 @@ cfg_if! { .field("ss_family", &self.ss_family) .field("__ss_pad1", &self.__ss_pad1) .field("__ss_pad2", &self.__ss_pad2) - // FIXME: .field("__ss_pad3", &self.__ss_pad3) + // FIXME(debug): .field("__ss_pad3", &self.__ss_pad3) .finish() } } @@ -636,7 +636,7 @@ cfg_if! { .field("d_ino", &self.d_ino) .field("d_pino", &self.d_pino) .field("d_reclen", &self.d_reclen) - // FIXME: .field("d_name", &self.d_name) + // FIXME(debug): .field("d_name", &self.d_name) .finish() } } @@ -868,7 +868,7 @@ pub const LC_NUMERIC: c_int = 4; pub const LC_TIME: c_int = 5; pub const LC_MESSAGES: c_int = 6; -// FIXME: Haiku does not have MAP_FILE, but library/std/os.rs requires it +// FIXME(haiku): Haiku does not have MAP_FILE, but library/std/os.rs requires it pub const MAP_FILE: c_int = 0x00; pub const MAP_SHARED: c_int = 0x01; pub const MAP_PRIVATE: c_int = 0x02; @@ -1302,7 +1302,7 @@ pub const PTHREAD_MUTEX_NORMAL: c_int = 1; pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 2; pub const PTHREAD_MUTEX_RECURSIVE: c_int = 3; -pub const FIOCLEX: c_ulong = 0; // FIXME: does not exist on Haiku! +pub const FIOCLEX: c_ulong = 0; // FIXME(haiku): does not exist on Haiku! pub const RUSAGE_CHILDREN: c_int = -1; diff --git a/src/unix/haiku/x86_64.rs b/src/unix/haiku/x86_64.rs index e77588df59f4f..548c8e06b825c 100644 --- a/src/unix/haiku/x86_64.rs +++ b/src/unix/haiku/x86_64.rs @@ -94,9 +94,9 @@ cfg_if! { .field("rdp", &self.rdp) .field("mxcsr", &self.mxcsr) .field("mscsr_mask", &self.mscsr_mask) - // FIXME: .field("_fpreg", &self._fpreg) - // FIXME: .field("_xmm", &self._xmm) - // FIXME: .field("_reserved_416_511", &self._reserved_416_511) + // FIXME(debug): .field("_fpreg", &self._fpreg) + // FIXME(debug): .field("_xmm", &self._xmm) + // FIXME(debug): .field("_reserved_416_511", &self._reserved_416_511) .finish() } } @@ -133,7 +133,7 @@ cfg_if! { f.debug_struct("xstate_hdr") .field("bv", &self.bv) .field("xcomp_bv", &self.xcomp_bv) - // FIXME: .field("_reserved", &field._reserved) + // FIXME(debug): .field("_reserved", &field._reserved) .finish() } } @@ -162,7 +162,7 @@ cfg_if! { f.debug_struct("savefpu") .field("fp_fxsave", &self.fp_fxsave) .field("fp_xstate", &self.fp_xstate) - // FIXME: .field("_fp_ymm", &field._fp_ymm) + // FIXME(debug): .field("_fp_ymm", &field._fp_ymm) .finish() } } diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 0c5f001202844..8703f4d37a66d 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -3524,14 +3524,6 @@ f! { set1.bits == set2.bits } - pub fn major(dev: crate::dev_t) -> c_uint { - ((dev >> 8) & 0xff) as c_uint - } - - pub fn minor(dev: crate::dev_t) -> c_uint { - (dev & 0xffff00ff) as c_uint - } - pub fn IPTOS_TOS(tos: u8) -> u8 { tos & IPTOS_TOS_MASK } @@ -4566,6 +4558,14 @@ safe_f! { dev } + pub {const} fn major(dev: crate::dev_t) -> c_uint { + ((dev >> 8) & 0xff) as c_uint + } + + pub {const} fn minor(dev: crate::dev_t) -> c_uint { + (dev & 0xffff00ff) as c_uint + } + pub fn SIGRTMAX() -> c_int { unsafe { __libc_current_sigrtmax() } } diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 5debbe8fb967d..ba9527c01ec2c 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -517,6 +517,11 @@ s! { pub ifr6_prefixlen: u32, pub ifr6_ifindex: c_int, } + + pub struct if_nameindex { + pub if_index: c_uint, + pub if_name: *mut c_char, + } } s_no_extra_traits! { @@ -1474,6 +1479,7 @@ pub const SOCK_STREAM: c_int = 1; pub const SOCK_DGRAM: c_int = 2; pub const SOCK_SEQPACKET: c_int = 5; pub const SOCK_DCCP: c_int = 6; +#[deprecated(since = "0.2.70", note = "AF_PACKET must be used instead")] pub const SOCK_PACKET: c_int = 10; pub const IPPROTO_MAX: c_int = 256; @@ -3646,12 +3652,6 @@ f! { set1.__bits == set2.__bits } - pub fn major(dev: crate::dev_t) -> c_int { - ((dev >> 8) & 0xfff) as c_int - } - pub fn minor(dev: crate::dev_t) -> c_int { - ((dev & 0xff) | ((dev >> 12) & 0xfff00)) as c_int - } pub fn NLA_ALIGN(len: c_int) -> c_int { return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1); } @@ -3667,6 +3667,14 @@ safe_f! { let mi = mi as crate::dev_t; ((ma & 0xfff) << 8) | (mi & 0xff) | ((mi & 0xfff00) << 12) } + + pub {const} fn major(dev: crate::dev_t) -> c_int { + ((dev >> 8) & 0xfff) as c_int + } + + pub {const} fn minor(dev: crate::dev_t) -> c_int { + ((dev & 0xff) | ((dev >> 12) & 0xfff00)) as c_int + } } extern "C" { @@ -4133,6 +4141,9 @@ extern "C" { newpath: *const c_char, flags: c_uint, ) -> c_int; + + pub fn if_nameindex() -> *mut if_nameindex; + pub fn if_freenameindex(ptr: *mut if_nameindex); } cfg_if! { diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index f22843e54073f..09de6f7d1e191 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -1452,41 +1452,41 @@ f! { pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { set1.bits == set2.bits } +} + +safe_f! { + pub {const} fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { + let major = major as crate::dev_t; + let minor = minor as crate::dev_t; + let mut dev = 0; + dev |= (major & 0xfffff000) << 31 << 1; + dev |= (major & 0x00000fff) << 8; + dev |= (minor & 0xffffff00) << 12; + dev |= minor & 0x000000ff; + dev + } - pub fn major(dev: crate::dev_t) -> c_uint { + pub {const} fn major(dev: crate::dev_t) -> c_uint { // see // https://github.com/emscripten-core/emscripten/blob/ // main/system/lib/libc/musl/include/sys/sysmacros.h let mut major = 0; - major |= (dev & 0x00000fff) >> 8; - major |= (dev & 0xfffff000) >> 31 >> 1; + major |= (dev >> 31 >> 1) & 0xfffff000; + major |= (dev >> 8) & 0x00000fff; major as c_uint } - pub fn minor(dev: crate::dev_t) -> c_uint { + pub {const} fn minor(dev: crate::dev_t) -> c_uint { // see // https://github.com/emscripten-core/emscripten/blob/ // main/system/lib/libc/musl/include/sys/sysmacros.h let mut minor = 0; - minor |= (dev & 0x000000ff) >> 0; - minor |= (dev & 0xffffff00) >> 12; + minor |= (dev >> 12) & 0xffffff00; + minor |= dev & 0x000000ff; minor as c_uint } } -safe_f! { - pub {const} fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { - let major = major as crate::dev_t; - let minor = minor as crate::dev_t; - let mut dev = 0; - dev |= (major & 0x00000fff) << 8; - dev |= (major & 0xfffff000) << 31 << 1; - dev |= (minor & 0x000000ff) << 0; - dev |= (minor & 0xffffff00) << 12; - dev - } -} - extern "C" { pub fn getrlimit(resource: c_int, rlim: *mut crate::rlimit) -> c_int; pub fn setrlimit(resource: c_int, rlim: *const crate::rlimit) -> c_int; diff --git a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs index b15df99e50ec6..249ed09a0dadd 100644 --- a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs @@ -4,6 +4,30 @@ use crate::{off64_t, off_t}; pub type wchar_t = i32; s! { + pub struct stat { + pub st_dev: c_ulong, + + st_pad1: [c_long; 3], + pub st_ino: crate::ino_t, + pub st_mode: crate::mode_t, + pub st_nlink: crate::nlink_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, + pub st_rdev: c_ulong, + st_pad2: [c_long; 2], + pub st_size: off_t, + st_pad3: c_long, + pub st_atime: crate::time_t, + pub st_atime_nsec: c_long, + pub st_mtime: crate::time_t, + pub st_mtime_nsec: c_long, + pub st_ctime: crate::time_t, + pub st_ctime_nsec: c_long, + pub st_blksize: crate::blksize_t, + pub st_blocks: crate::blkcnt_t, + st_pad5: [c_long; 14], + } + pub struct stat64 { pub st_dev: c_ulong, st_pad1: [c_long; 3], diff --git a/src/unix/linux_like/linux/gnu/b32/mod.rs b/src/unix/linux_like/linux/gnu/b32/mod.rs index 2cdd1320bf3e3..134bfb05b7470 100644 --- a/src/unix/linux_like/linux/gnu/b32/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mod.rs @@ -40,55 +40,37 @@ cfg_if! { } } -s! { - pub struct stat { - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - pub st_dev: crate::dev_t, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - pub st_dev: c_ulong, - - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - __pad1: c_short, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - st_pad1: [c_long; 3], - pub st_ino: crate::ino_t, - pub st_mode: crate::mode_t, - pub st_nlink: crate::nlink_t, - pub st_uid: crate::uid_t, - pub st_gid: crate::gid_t, - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - pub st_rdev: crate::dev_t, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - pub st_rdev: c_ulong, - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - __pad2: c_short, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - st_pad2: [c_long; 2], - pub st_size: off_t, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - st_pad3: c_long, - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - pub st_blksize: crate::blksize_t, - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - pub st_blocks: crate::blkcnt_t, - pub st_atime: crate::time_t, - pub st_atime_nsec: c_long, - pub st_mtime: crate::time_t, - pub st_mtime_nsec: c_long, - pub st_ctime: crate::time_t, - pub st_ctime_nsec: c_long, - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - __unused4: c_long, - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - __unused5: c_long, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - pub st_blksize: crate::blksize_t, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - pub st_blocks: crate::blkcnt_t, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - st_pad5: [c_long; 14], +cfg_if! { + if #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] { + s! { + pub struct stat { + pub st_dev: crate::dev_t, + + __pad1: c_short, + pub st_ino: crate::ino_t, + pub st_mode: crate::mode_t, + pub st_nlink: crate::nlink_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, + pub st_rdev: crate::dev_t, + __pad2: c_short, + pub st_size: off_t, + pub st_blksize: crate::blksize_t, + pub st_blocks: crate::blkcnt_t, + pub st_atime: crate::time_t, + pub st_atime_nsec: c_long, + pub st_mtime: crate::time_t, + pub st_mtime_nsec: c_long, + pub st_ctime: crate::time_t, + pub st_ctime_nsec: c_long, + __unused4: c_long, + __unused5: c_long, + } + } } +} +s! { pub struct statvfs { pub f_bsize: c_ulong, pub f_frsize: c_ulong, diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs index 291d78393fe9d..9bcc2717c7bd1 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs @@ -308,7 +308,7 @@ s_no_extra_traits! { pub uc_mcontext: mcontext_t, pub uc_sigmask: crate::sigset_t, __private: [u8; 512], - // FIXME(linux): the shadow stack field requires glibc >= 2.28. + // FIXME(glibc): the shadow stack field requires glibc >= 2.28. // Re-add once we drop compatibility with glibc versions older than // 2.28. // diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 48648e2b05a99..0272166e76e14 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -328,84 +328,6 @@ s! { pub u: __c_anonymous_ptrace_syscall_info_data, } - // linux/if_xdp.h - - pub struct sockaddr_xdp { - pub sxdp_family: crate::__u16, - pub sxdp_flags: crate::__u16, - pub sxdp_ifindex: crate::__u32, - pub sxdp_queue_id: crate::__u32, - pub sxdp_shared_umem_fd: crate::__u32, - } - - pub struct xdp_ring_offset { - pub producer: crate::__u64, - pub consumer: crate::__u64, - pub desc: crate::__u64, - pub flags: crate::__u64, - } - - pub struct xdp_mmap_offsets { - pub rx: xdp_ring_offset, - pub tx: xdp_ring_offset, - pub fr: xdp_ring_offset, - pub cr: xdp_ring_offset, - } - - pub struct xdp_ring_offset_v1 { - pub producer: crate::__u64, - pub consumer: crate::__u64, - pub desc: crate::__u64, - } - - pub struct xdp_mmap_offsets_v1 { - pub rx: xdp_ring_offset_v1, - pub tx: xdp_ring_offset_v1, - pub fr: xdp_ring_offset_v1, - pub cr: xdp_ring_offset_v1, - } - - pub struct xdp_umem_reg { - pub addr: crate::__u64, - pub len: crate::__u64, - pub chunk_size: crate::__u32, - pub headroom: crate::__u32, - pub flags: crate::__u32, - pub tx_metadata_len: crate::__u32, - } - - pub struct xdp_umem_reg_v1 { - pub addr: crate::__u64, - pub len: crate::__u64, - pub chunk_size: crate::__u32, - pub headroom: crate::__u32, - } - - pub struct xdp_statistics { - pub rx_dropped: crate::__u64, - pub rx_invalid_descs: crate::__u64, - pub tx_invalid_descs: crate::__u64, - pub rx_ring_full: crate::__u64, - pub rx_fill_ring_empty_descs: crate::__u64, - pub tx_ring_empty_descs: crate::__u64, - } - - pub struct xdp_statistics_v1 { - pub rx_dropped: crate::__u64, - pub rx_invalid_descs: crate::__u64, - pub tx_invalid_descs: crate::__u64, - } - - pub struct xdp_options { - pub flags: crate::__u32, - } - - pub struct xdp_desc { - pub addr: crate::__u64, - pub len: crate::__u32, - pub options: crate::__u32, - } - pub struct iocb { pub aio_data: crate::__u64, #[cfg(target_endian = "little")] @@ -809,7 +731,6 @@ pub const SOL_RDS: c_int = 276; pub const SOL_IUCV: c_int = 277; pub const SOL_CAIF: c_int = 278; pub const SOL_NFC: c_int = 280; -pub const SOL_XDP: c_int = 283; pub const MSG_TRYHARD: c_int = 4; @@ -842,6 +763,7 @@ pub const ENOTSUP: c_int = EOPNOTSUPP; pub const SOCK_SEQPACKET: c_int = 5; pub const SOCK_DCCP: c_int = 6; +#[deprecated(since = "0.2.70", note = "AF_PACKET must be used instead")] pub const SOCK_PACKET: c_int = 10; pub const AF_IB: c_int = 27; @@ -1042,38 +964,6 @@ pub const GENL_UNS_ADMIN_PERM: c_int = 0x10; pub const GENL_ID_VFS_DQUOT: c_int = crate::NLMSG_MIN_TYPE + 1; pub const GENL_ID_PMCRAID: c_int = crate::NLMSG_MIN_TYPE + 2; -// linux/if_xdp.h -pub const XDP_SHARED_UMEM: crate::__u16 = 1 << 0; -pub const XDP_COPY: crate::__u16 = 1 << 1; -pub const XDP_ZEROCOPY: crate::__u16 = 1 << 2; -pub const XDP_USE_NEED_WAKEUP: crate::__u16 = 1 << 3; -pub const XDP_USE_SG: crate::__u16 = 1 << 4; - -pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG: crate::__u32 = 1 << 0; - -pub const XDP_RING_NEED_WAKEUP: crate::__u32 = 1 << 0; - -pub const XDP_MMAP_OFFSETS: c_int = 1; -pub const XDP_RX_RING: c_int = 2; -pub const XDP_TX_RING: c_int = 3; -pub const XDP_UMEM_REG: c_int = 4; -pub const XDP_UMEM_FILL_RING: c_int = 5; -pub const XDP_UMEM_COMPLETION_RING: c_int = 6; -pub const XDP_STATISTICS: c_int = 7; -pub const XDP_OPTIONS: c_int = 8; - -pub const XDP_OPTIONS_ZEROCOPY: crate::__u32 = 1 << 0; - -pub const XDP_PGOFF_RX_RING: off_t = 0; -pub const XDP_PGOFF_TX_RING: off_t = 0x80000000; -pub const XDP_UMEM_PGOFF_FILL_RING: c_ulonglong = 0x100000000; -pub const XDP_UMEM_PGOFF_COMPLETION_RING: c_ulonglong = 0x180000000; - -pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT: c_int = 48; -pub const XSK_UNALIGNED_BUF_ADDR_MASK: c_ulonglong = (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1; - -pub const XDP_PKT_CONTD: crate::__u32 = 1 << 0; - pub const ELFOSABI_ARM_AEABI: u8 = 64; // linux/sched.h diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 63049fe1c5547..b36e0891741fa 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -186,6 +186,7 @@ s! { pub mr_address: [c_uchar; 8], } + #[deprecated(since = "0.2.70", note = "sockaddr_ll type must be used instead")] pub struct sockaddr_pkt { pub spkt_family: c_ushort, pub spkt_device: [c_uchar; 14], @@ -1225,6 +1226,83 @@ s! { } // linux/if_xdp.h + + pub struct sockaddr_xdp { + pub sxdp_family: crate::__u16, + pub sxdp_flags: crate::__u16, + pub sxdp_ifindex: crate::__u32, + pub sxdp_queue_id: crate::__u32, + pub sxdp_shared_umem_fd: crate::__u32, + } + + pub struct xdp_ring_offset { + pub producer: crate::__u64, + pub consumer: crate::__u64, + pub desc: crate::__u64, + pub flags: crate::__u64, + } + + pub struct xdp_mmap_offsets { + pub rx: xdp_ring_offset, + pub tx: xdp_ring_offset, + pub fr: xdp_ring_offset, + pub cr: xdp_ring_offset, + } + + pub struct xdp_ring_offset_v1 { + pub producer: crate::__u64, + pub consumer: crate::__u64, + pub desc: crate::__u64, + } + + pub struct xdp_mmap_offsets_v1 { + pub rx: xdp_ring_offset_v1, + pub tx: xdp_ring_offset_v1, + pub fr: xdp_ring_offset_v1, + pub cr: xdp_ring_offset_v1, + } + + pub struct xdp_umem_reg { + pub addr: crate::__u64, + pub len: crate::__u64, + pub chunk_size: crate::__u32, + pub headroom: crate::__u32, + pub flags: crate::__u32, + pub tx_metadata_len: crate::__u32, + } + + pub struct xdp_umem_reg_v1 { + pub addr: crate::__u64, + pub len: crate::__u64, + pub chunk_size: crate::__u32, + pub headroom: crate::__u32, + } + + pub struct xdp_statistics { + pub rx_dropped: crate::__u64, + pub rx_invalid_descs: crate::__u64, + pub tx_invalid_descs: crate::__u64, + pub rx_ring_full: crate::__u64, + pub rx_fill_ring_empty_descs: crate::__u64, + pub tx_ring_empty_descs: crate::__u64, + } + + pub struct xdp_statistics_v1 { + pub rx_dropped: crate::__u64, + pub rx_invalid_descs: crate::__u64, + pub tx_invalid_descs: crate::__u64, + } + + pub struct xdp_options { + pub flags: crate::__u32, + } + + pub struct xdp_desc { + pub addr: crate::__u64, + pub len: crate::__u32, + pub options: crate::__u32, + } + pub struct xsk_tx_metadata_completion { pub tx_timestamp: crate::__u64, } @@ -2940,6 +3018,19 @@ pub const MSG_NOERROR: c_int = 0o10000; pub const MSG_EXCEPT: c_int = 0o20000; pub const MSG_ZEROCOPY: c_int = 0x4000000; +pub const SEM_UNDO: c_int = 0x1000; + +pub const GETPID: c_int = 11; +pub const GETVAL: c_int = 12; +pub const GETALL: c_int = 13; +pub const GETNCNT: c_int = 14; +pub const GETZCNT: c_int = 15; +pub const SETVAL: c_int = 16; +pub const SETALL: c_int = 17; +pub const SEM_STAT: c_int = 18; +pub const SEM_INFO: c_int = 19; +pub const SEM_STAT_ANY: c_int = 20; + pub const SHM_R: c_int = 0o400; pub const SHM_W: c_int = 0o200; @@ -5671,13 +5762,47 @@ pub const SCHED_FLAG_UTIL_CLAMP_MIN: c_int = 0x20; pub const SCHED_FLAG_UTIL_CLAMP_MAX: c_int = 0x40; // linux/if_xdp.h -pub const XDP_UMEM_TX_SW_CSUM: __u32 = 1 << 1; -pub const XDP_UMEM_TX_METADATA_LEN: __u32 = 1 << 2; +pub const XDP_SHARED_UMEM: crate::__u16 = 1 << 0; +pub const XDP_COPY: crate::__u16 = 1 << 1; +pub const XDP_ZEROCOPY: crate::__u16 = 1 << 2; +pub const XDP_USE_NEED_WAKEUP: crate::__u16 = 1 << 3; +pub const XDP_USE_SG: crate::__u16 = 1 << 4; + +pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG: crate::__u32 = 1 << 0; + +pub const XDP_RING_NEED_WAKEUP: crate::__u32 = 1 << 0; + +pub const XDP_MMAP_OFFSETS: c_int = 1; +pub const XDP_RX_RING: c_int = 2; +pub const XDP_TX_RING: c_int = 3; +pub const XDP_UMEM_REG: c_int = 4; +pub const XDP_UMEM_FILL_RING: c_int = 5; +pub const XDP_UMEM_COMPLETION_RING: c_int = 6; +pub const XDP_STATISTICS: c_int = 7; +pub const XDP_OPTIONS: c_int = 8; + +pub const XDP_OPTIONS_ZEROCOPY: crate::__u32 = 1 << 0; -pub const XDP_TXMD_FLAGS_TIMESTAMP: __u32 = 1 << 0; -pub const XDP_TXMD_FLAGS_CHECKSUM: __u32 = 1 << 1; +pub const XDP_PGOFF_RX_RING: crate::off_t = 0; +pub const XDP_PGOFF_TX_RING: crate::off_t = 0x80000000; +pub const XDP_UMEM_PGOFF_FILL_RING: crate::c_ulonglong = 0x100000000; +pub const XDP_UMEM_PGOFF_COMPLETION_RING: crate::c_ulonglong = 0x180000000; -pub const XDP_TX_METADATA: __u32 = 1 << 1; +pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT: crate::c_int = 48; +pub const XSK_UNALIGNED_BUF_ADDR_MASK: crate::c_ulonglong = + (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1; + +pub const XDP_PKT_CONTD: crate::__u32 = 1 << 0; + +pub const XDP_UMEM_TX_SW_CSUM: crate::__u32 = 1 << 1; +pub const XDP_UMEM_TX_METADATA_LEN: crate::__u32 = 1 << 2; + +pub const XDP_TXMD_FLAGS_TIMESTAMP: crate::__u32 = 1 << 0; +pub const XDP_TXMD_FLAGS_CHECKSUM: crate::__u32 = 1 << 1; + +pub const XDP_TX_METADATA: crate::__u32 = 1 << 1; + +pub const SOL_XDP: c_int = 283; // linux/mount.h pub const MOUNT_ATTR_RDONLY: crate::__u64 = 0x00000001; @@ -5894,20 +6019,6 @@ f! { () } - pub fn major(dev: crate::dev_t) -> c_uint { - let mut major = 0; - major |= (dev & 0x00000000000fff00) >> 8; - major |= (dev & 0xfffff00000000000) >> 32; - major as c_uint - } - - pub fn minor(dev: crate::dev_t) -> c_uint { - let mut minor = 0; - minor |= (dev & 0x00000000000000ff) >> 0; - minor |= (dev & 0x00000ffffff00000) >> 12; - minor as c_uint - } - pub fn IPTOS_TOS(tos: u8) -> u8 { tos & IPTOS_TOS_MASK } @@ -5999,6 +6110,20 @@ safe_f! { dev } + pub {const} fn major(dev: crate::dev_t) -> c_uint { + let mut major = 0; + major |= (dev & 0x00000000000fff00) >> 8; + major |= (dev & 0xfffff00000000000) >> 32; + major as c_uint + } + + pub {const} fn minor(dev: crate::dev_t) -> c_uint { + let mut minor = 0; + minor |= (dev & 0x00000000000000ff) >> 0; + minor |= (dev & 0x00000ffffff00000) >> 12; + minor as c_uint + } + pub {const} fn SCTP_PR_TTL_ENABLED(policy: c_int) -> bool { policy == SCTP_PR_SCTP_TTL } diff --git a/src/unix/linux_like/linux/musl/b32/hexagon.rs b/src/unix/linux_like/linux/musl/b32/hexagon.rs index f58eccca4edb3..4ae82af9c5d22 100644 --- a/src/unix/linux_like/linux/musl/b32/hexagon.rs +++ b/src/unix/linux_like/linux/musl/b32/hexagon.rs @@ -286,7 +286,7 @@ 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(musl) +pub const SYS_copy_file_range: c_int = -1; // FIXME(hexagon) pub const SYS_creat: c_int = 1064; pub const SYS_delete_module: c_int = 106; pub const SYS_dup2: c_int = 1041; diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 81ee07483e7b4..b474a6f3e4dfe 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -314,84 +314,6 @@ s! { pub esterror: c_long, } - // linux/if_xdp.h - - pub struct sockaddr_xdp { - pub sxdp_family: crate::__u16, - pub sxdp_flags: crate::__u16, - pub sxdp_ifindex: crate::__u32, - pub sxdp_queue_id: crate::__u32, - pub sxdp_shared_umem_fd: crate::__u32, - } - - pub struct xdp_ring_offset { - pub producer: crate::__u64, - pub consumer: crate::__u64, - pub desc: crate::__u64, - pub flags: crate::__u64, - } - - pub struct xdp_mmap_offsets { - pub rx: xdp_ring_offset, - pub tx: xdp_ring_offset, - pub fr: xdp_ring_offset, - pub cr: xdp_ring_offset, - } - - pub struct xdp_ring_offset_v1 { - pub producer: crate::__u64, - pub consumer: crate::__u64, - pub desc: crate::__u64, - } - - pub struct xdp_mmap_offsets_v1 { - pub rx: xdp_ring_offset_v1, - pub tx: xdp_ring_offset_v1, - pub fr: xdp_ring_offset_v1, - pub cr: xdp_ring_offset_v1, - } - - pub struct xdp_umem_reg { - pub addr: crate::__u64, - pub len: crate::__u64, - pub chunk_size: crate::__u32, - pub headroom: crate::__u32, - pub flags: crate::__u32, - pub tx_metadata_len: crate::__u32, - } - - pub struct xdp_umem_reg_v1 { - pub addr: crate::__u64, - pub len: crate::__u64, - pub chunk_size: crate::__u32, - pub headroom: crate::__u32, - } - - pub struct xdp_statistics { - pub rx_dropped: crate::__u64, - pub rx_invalid_descs: crate::__u64, - pub tx_invalid_descs: crate::__u64, - pub rx_ring_full: crate::__u64, - pub rx_fill_ring_empty_descs: crate::__u64, - pub tx_ring_empty_descs: crate::__u64, - } - - pub struct xdp_statistics_v1 { - pub rx_dropped: crate::__u64, - pub rx_invalid_descs: crate::__u64, - pub tx_invalid_descs: crate::__u64, - } - - pub struct xdp_options { - pub flags: crate::__u32, - } - - pub struct xdp_desc { - pub addr: crate::__u64, - pub len: crate::__u32, - pub options: crate::__u32, - } - // netinet/tcp.h pub struct tcp_info { @@ -794,6 +716,7 @@ pub const MAP_ANONYMOUS: c_int = MAP_ANON; pub const SOCK_SEQPACKET: c_int = 5; pub const SOCK_DCCP: c_int = 6; pub const SOCK_NONBLOCK: c_int = O_NONBLOCK; +#[deprecated(since = "0.2.70", note = "AF_PACKET must be used instead")] pub const SOCK_PACKET: c_int = 10; pub const SOMAXCONN: c_int = 128; @@ -958,40 +881,6 @@ pub const TIME_ERROR: c_int = 5; pub const TIME_BAD: c_int = TIME_ERROR; pub const MAXTC: c_long = 6; -pub const SOL_XDP: c_int = 283; - -// linux/if_xdp.h -pub const XDP_SHARED_UMEM: crate::__u16 = 1 << 0; -pub const XDP_COPY: crate::__u16 = 1 << 1; -pub const XDP_ZEROCOPY: crate::__u16 = 1 << 2; -pub const XDP_USE_NEED_WAKEUP: crate::__u16 = 1 << 3; -pub const XDP_USE_SG: crate::__u16 = 1 << 4; - -pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG: crate::__u32 = 1 << 0; - -pub const XDP_RING_NEED_WAKEUP: crate::__u32 = 1 << 0; - -pub const XDP_MMAP_OFFSETS: c_int = 1; -pub const XDP_RX_RING: c_int = 2; -pub const XDP_TX_RING: c_int = 3; -pub const XDP_UMEM_REG: c_int = 4; -pub const XDP_UMEM_FILL_RING: c_int = 5; -pub const XDP_UMEM_COMPLETION_RING: c_int = 6; -pub const XDP_STATISTICS: c_int = 7; -pub const XDP_OPTIONS: c_int = 8; - -pub const XDP_OPTIONS_ZEROCOPY: crate::__u32 = 1 << 0; - -pub const XDP_PGOFF_RX_RING: off_t = 0; -pub const XDP_PGOFF_TX_RING: off_t = 0x80000000; -pub const XDP_UMEM_PGOFF_FILL_RING: c_ulonglong = 0x100000000; -pub const XDP_UMEM_PGOFF_COMPLETION_RING: c_ulonglong = 0x180000000; - -pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT: c_int = 48; -pub const XSK_UNALIGNED_BUF_ADDR_MASK: c_ulonglong = (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1; - -pub const XDP_PKT_CONTD: crate::__u32 = 1 << 0; - pub const _CS_V6_ENV: c_int = 1148; pub const _CS_V7_ENV: c_int = 1149; diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index 7495f07878119..272f3c4e223b2 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -382,6 +382,7 @@ pub const RUSAGE_THREAD: c_int = 1; pub const SHM_EXEC: c_int = 0o100000; pub const SIGPOLL: c_int = SIGIO; pub const SOCK_DCCP: c_int = 6; +#[deprecated(since = "0.2.70", note = "AF_PACKET must be used instead")] pub const SOCK_PACKET: c_int = 10; pub const TCP_COOKIE_TRANSACTIONS: c_int = 15; pub const UDP_GRO: c_int = 104; diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index c7ff2aea96e79..b3e6281f48d28 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1293,9 +1293,17 @@ pub const SI_LOAD_SHIFT: c_uint = 16; pub const SI_USER: c_int = 0; pub const SI_KERNEL: c_int = 0x80; pub const SI_QUEUE: c_int = -1; -pub const SI_TIMER: c_int = -2; -pub const SI_MESGQ: c_int = -3; -pub const SI_ASYNCIO: c_int = -4; +cfg_if! { + if #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] { + pub const SI_TIMER: c_int = -2; + pub const SI_MESGQ: c_int = -3; + pub const SI_ASYNCIO: c_int = -4; + } else { + pub const SI_TIMER: c_int = -3; + pub const SI_MESGQ: c_int = -4; + pub const SI_ASYNCIO: c_int = -2; + } +} pub const SI_SIGIO: c_int = -5; pub const SI_TKILL: c_int = -6; pub const SI_ASYNCNL: c_int = -60; @@ -1748,11 +1756,7 @@ safe_f! { #[allow(ellipsis_inclusive_range_patterns)] pub {const} fn KERNEL_VERSION(a: u32, b: u32, c: u32) -> u32 { - ((a << 16) + (b << 8)) - + match c { - 0..=255 => c, - _ => 255, - } + ((a << 16) + (b << 8)) + if c > 255 { 255 } else { c } } } diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs index ad4b390d61c07..c1457d631acf1 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -806,7 +806,7 @@ cfg_if! { f.debug_struct("sockaddr_un") .field("sun_len", &self.sun_len) .field("sun_family", &self.sun_family) - // FIXME: .field("sun_path", &self.sun_path) + // FIXME(debug): .field("sun_path", &self.sun_path) .finish() } } @@ -1015,11 +1015,11 @@ cfg_if! { 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(debug): .field("sysname", &self.sysname) + // FIXME(debug): .field("nodename", &self.nodename) + // FIXME(debug): .field("release", &self.release) + // FIXME(debug): .field("version", &self.version) + // FIXME(debug): .field("machine", &self.machine) .finish() } } @@ -1095,7 +1095,7 @@ cfg_if! { .field("ss_family", &self.ss_family) .field("__ss_pad1", &self.__ss_pad1) .field("__ss_align", &self.__ss_align) - // FIXME: .field("__ss_pad2", &self.__ss_pad2) + // FIXME(debug): .field("__ss_pad2", &self.__ss_pad2) .finish() } } @@ -2804,14 +2804,6 @@ f! { let ngrps = if ngrps > 0 { ngrps - 1 } else { 0 }; mem::size_of::() + mem::size_of::() * ngrps } - - pub fn major(dev: crate::dev_t) -> c_uint { - ((dev as c_uint) >> 10) & 0x3f - } - - pub fn minor(dev: crate::dev_t) -> c_uint { - (dev as c_uint) & 0x3ff - } } safe_f! { @@ -2854,6 +2846,14 @@ safe_f! { pub {const} fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { ((major << 10) | (minor)) as crate::dev_t } + + pub {const} fn major(dev: crate::dev_t) -> c_uint { + ((dev as c_uint) >> 10) & 0x3f + } + + pub {const} fn minor(dev: crate::dev_t) -> c_uint { + (dev as c_uint) & 0x3ff + } } // Network related functions are provided by libsocket and regex diff --git a/src/unix/nuttx/mod.rs b/src/unix/nuttx/mod.rs index f77b104493670..8446eafaf19e6 100644 --- a/src/unix/nuttx/mod.rs +++ b/src/unix/nuttx/mod.rs @@ -52,6 +52,7 @@ s! { pub struct passwd { pub pw_name: *const c_char, + pub pw_passwd: *const c_char, pub pw_uid: u32, pub pw_gid: u32, pub pw_gecos: *const c_char, @@ -126,7 +127,7 @@ s! { pub tm_yday: i32, pub tm_isdst: i32, pub tm_gmtoff: isize, - pub tm_zone: *const i8, + pub tm_zone: *const c_char, __reserved: [usize; __DEFAULT_RESERVED_SIZE__], } @@ -163,7 +164,7 @@ s! { pub struct dirent { pub d_type: u8, - pub d_name: [i8; __NAME_MAX__ + 1], + pub d_name: [c_char; __NAME_MAX__ + 1], } pub struct fd_set { @@ -245,6 +246,7 @@ s! { // for example, struct passwd, https://pubs.opengroup.org/onlinepubs/009695399/basedefs/pwd.h.html, // POSIX only defines following fields in struct passwd: // char *pw_name User's login name. +// char *pw_passwd Encrypted password. // uid_t pw_uid Numerical user ID. // gid_t pw_gid Numerical group ID. // char *pw_dir Initial working directory. @@ -554,7 +556,6 @@ extern "C" { pub fn clock_gettime(clockid: clockid_t, tp: *mut timespec) -> i32; pub fn futimens(fd: i32, times: *const timespec) -> i32; pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, clock_id: clockid_t) -> i32; - pub fn pthread_set_name_np(thread: pthread_t, name: *const c_char) -> i32; pub fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> i32; pub fn pthread_getname_np(thread: pthread_t, name: *mut c_char, len: usize) -> i32; pub fn getrandom(buf: *mut c_void, buflen: usize, flags: u32) -> isize; diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 3a335357d6b6b..65aaccec2ba96 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -589,7 +589,7 @@ cfg_if! { 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) + // FIXME(debug): .field("sun_path", &self.sun_path) .finish() } } @@ -632,11 +632,11 @@ cfg_if! { 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(debug): .field("sysname", &self.sysname) + // FIXME(debug): .field("nodename", &self.nodename) + // FIXME(debug): .field("release", &self.release) + // FIXME(debug): .field("version", &self.version) + // FIXME(debug): .field("machine", &self.machine) .finish() } } @@ -662,7 +662,7 @@ cfg_if! { impl fmt::Debug for fd_set { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("fd_set") - // FIXME: .field("fds_bits", &self.fds_bits) + // FIXME(debug): .field("fds_bits", &self.fds_bits) .finish() } } @@ -691,7 +691,7 @@ cfg_if! { .field("ss_family", &self.ss_family) .field("__ss_pad1", &self.__ss_pad1) .field("__ss_align", &self.__ss_align) - // FIXME: .field("__ss_pad2", &self.__ss_pad2) + // FIXME(debug): .field("__ss_pad2", &self.__ss_pad2) .finish() } } @@ -740,7 +740,7 @@ cfg_if! { && self.si_code == other.si_code && self.si_errno == other.si_errno { - // FIXME: The `si_pad` field in the 64-bit version of the struct is ignored + // FIXME(solarish): The `si_pad` field in the 64-bit version of the struct is ignored // (for now) when doing comparisons. let field_count = self.data_field_count(); @@ -760,7 +760,7 @@ cfg_if! { .field("si_signo", &self.si_signo) .field("si_code", &self.si_code) .field("si_errno", &self.si_errno) - // FIXME: .field("__pad", &self.__pad) + // FIXME(debug): .field("__pad", &self.__pad) .finish() } } @@ -770,7 +770,7 @@ cfg_if! { self.si_code.hash(state); self.si_errno.hash(state); - // FIXME: The `si_pad` field in the 64-bit version of the struct is ignored + // FIXME(solarish): The `si_pad` field in the 64-bit version of the struct is ignored // (for now) when doing hashing. let field_count = self.data_field_count(); @@ -803,7 +803,7 @@ cfg_if! { .field("sdl_nlen", &self.sdl_nlen) .field("sdl_alen", &self.sdl_alen) .field("sdl_slen", &self.sdl_slen) - // FIXME: .field("sdl_data", &self.sdl_data) + // FIXME(debug): .field("sdl_data", &self.sdl_data) .finish() } } @@ -853,7 +853,7 @@ cfg_if! { impl PartialEq for pad128_t { fn eq(&self, other: &pad128_t) -> bool { unsafe { - // FIXME: self._q == other._q || + // FIXME(solarish): self._q == other._q || self._l == other._l } } @@ -862,7 +862,7 @@ cfg_if! { impl hash::Hash for pad128_t { fn hash(&self, state: &mut H) { unsafe { - // FIXME: state.write_i64(self._q as i64); + // FIXME(solarish): state.write_i64(self._q as i64); self._l.hash(state); } } @@ -870,7 +870,7 @@ cfg_if! { impl PartialEq for upad128_t { fn eq(&self, other: &upad128_t) -> bool { unsafe { - // FIXME: self._q == other._q || + // FIXME(solarish): self._q == other._q || self._l == other._l } } @@ -879,7 +879,7 @@ cfg_if! { impl hash::Hash for upad128_t { fn hash(&self, state: &mut H) { unsafe { - // FIXME: state.write_i64(self._q as i64); + // FIXME(solarish): state.write_i64(self._q as i64); self._l.hash(state); } } @@ -1148,6 +1148,7 @@ pub const IPV6_DONTFRAG: c_int = 0x21; pub const IPV6_SEC_OPT: c_int = 0x22; pub const IPV6_TCLASS: c_int = 0x26; pub const IPV6_V6ONLY: c_int = 0x27; +pub const IPV6_BOUND_IF: c_int = 0x41; cfg_if! { if #[cfg(target_pointer_width = "64")] { @@ -1691,6 +1692,7 @@ pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 23; pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 24; pub const IP_BLOCK_SOURCE: c_int = 21; pub const IP_UNBLOCK_SOURCE: c_int = 22; +pub const IP_BOUND_IF: c_int = 0x41; // These TCP socket options are common between illumos and Solaris, while higher // numbers have generally diverged: