From 11079fd0eb651261c330ac0c72860dc3b146fc62 Mon Sep 17 00:00:00 2001 From: Ola x Nilsson Date: Wed, 20 Nov 2024 11:07:01 +0100 Subject: [PATCH 1/7] build.rs: Add linux_time_bits64 to ALLOWED_CFGS linux_time_bits64 will be used to match __USE_TIME_BITS64 in the uapi headers. The environment variable RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64 can be used by callers to enable the linux_time_bits64 config. (backport ) (cherry picked from commit 5453fe66f14aabb329ad508e99b114bcff51b0f0) --- build.rs | 7 +++++++ ci/verify-build.sh | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/build.rs b/build.rs index 5f401f9f1072e..2487f89e71563 100644 --- a/build.rs +++ b/build.rs @@ -18,6 +18,8 @@ const ALLOWED_CFGS: &'static [&'static str] = &[ "libc_deny_warnings", "libc_thread_local", "libc_ctest", + // Corresponds to `__USE_TIME_BITS64` in UAPI + "linux_time_bits64", ]; // Extra values to allow for check-cfg. @@ -43,6 +45,7 @@ fn main() { 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; + let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok(); // 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. @@ -79,6 +82,10 @@ fn main() { _ => (), } + if linux_time_bits64 { + set_cfg("linux_time_bits64"); + } + // On CI: deny all warnings if libc_ci { set_cfg("libc_deny_warnings"); diff --git a/ci/verify-build.sh b/ci/verify-build.sh index e61fc69188c59..ccdc223263641 100755 --- a/ci/verify-build.sh +++ b/ci/verify-build.sh @@ -72,6 +72,11 @@ test_target() { $cmd --features const-extern-fn $cmd --features extra_traits + if [ "$os" = "linux" ]; then + # Test with the equivalent of __USE_TIME_BITS64 + RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64=1 $cmd + fi + # Test again without default features, i.e. without "std" $cmd --no-default-features $cmd --no-default-features --features extra_traits From 4134091ef8b27aa58c3371a5a78adfb6b7c89615 Mon Sep 17 00:00:00 2001 From: Ola x Nilsson Date: Mon, 20 Mar 2023 14:21:04 +0100 Subject: [PATCH 2/7] linux: Set SO_TIMESTAMP* and SO_RCVTIMEO and SO_SNDTIMEO The actual values may be different on 32bit archs with and without __USE_TIME_BITS64 (backport ) (cherry picked from commit 616d546afb8c73de575450230c5da69ba91f7c3b) --- libc-test/semver/TODO-linux.txt | 1 - libc-test/semver/linux-loongarch64.txt | 1 - libc-test/semver/linux-powerpc64.txt | 1 - libc-test/semver/linux-powerpc64le.txt | 1 - libc-test/semver/linux-riscv64gc.txt | 1 - libc-test/semver/linux.txt | 1 + src/unix/linux_like/linux/arch/generic/mod.rs | 35 +++++++++++----- src/unix/linux_like/linux/arch/mips/mod.rs | 40 ++++++++++++------- src/unix/linux_like/linux/arch/powerpc/mod.rs | 31 ++++++++++---- 9 files changed, 74 insertions(+), 38 deletions(-) diff --git a/libc-test/semver/TODO-linux.txt b/libc-test/semver/TODO-linux.txt index 8427cf1ea12c8..98568ab0e9745 100644 --- a/libc-test/semver/TODO-linux.txt +++ b/libc-test/semver/TODO-linux.txt @@ -54,7 +54,6 @@ SO_SELECT_ERR_QUEUE SO_SNDTIMEO_NEW SO_STYLE SO_TIMESTAMPING_NEW -SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW SO_TIMESTAMP_NEW SO_TXTIME diff --git a/libc-test/semver/linux-loongarch64.txt b/libc-test/semver/linux-loongarch64.txt index ebcd4bf93356f..1302cb68b2c8a 100644 --- a/libc-test/semver/linux-loongarch64.txt +++ b/libc-test/semver/linux-loongarch64.txt @@ -87,7 +87,6 @@ SO_SECURITY_AUTHENTICATION SO_SECURITY_ENCRYPTION_NETWORK SO_SECURITY_ENCRYPTION_TRANSPORT SO_SELECT_ERR_QUEUE -SO_TIMESTAMPNS SO_WIFI_STATUS SYS_accept SYS_msgctl diff --git a/libc-test/semver/linux-powerpc64.txt b/libc-test/semver/linux-powerpc64.txt index 77718d9ce47f0..604add92838db 100644 --- a/libc-test/semver/linux-powerpc64.txt +++ b/libc-test/semver/linux-powerpc64.txt @@ -48,7 +48,6 @@ SO_SECURITY_AUTHENTICATION SO_SECURITY_ENCRYPTION_NETWORK SO_SECURITY_ENCRYPTION_TRANSPORT SO_SELECT_ERR_QUEUE -SO_TIMESTAMPNS SO_WIFI_STATUS SYS__llseek SYS__newselect diff --git a/libc-test/semver/linux-powerpc64le.txt b/libc-test/semver/linux-powerpc64le.txt index 99be508e6bd59..b4e5c4159a3d8 100644 --- a/libc-test/semver/linux-powerpc64le.txt +++ b/libc-test/semver/linux-powerpc64le.txt @@ -46,7 +46,6 @@ SO_SECURITY_AUTHENTICATION SO_SECURITY_ENCRYPTION_NETWORK SO_SECURITY_ENCRYPTION_TRANSPORT SO_SELECT_ERR_QUEUE -SO_TIMESTAMPNS SO_WIFI_STATUS SYS__llseek SYS__newselect diff --git a/libc-test/semver/linux-riscv64gc.txt b/libc-test/semver/linux-riscv64gc.txt index 13f5b85196790..09519e9dfbe7e 100644 --- a/libc-test/semver/linux-riscv64gc.txt +++ b/libc-test/semver/linux-riscv64gc.txt @@ -51,7 +51,6 @@ SO_SECURITY_AUTHENTICATION SO_SECURITY_ENCRYPTION_NETWORK SO_SECURITY_ENCRYPTION_TRANSPORT SO_SELECT_ERR_QUEUE -SO_TIMESTAMPNS SO_WIFI_STATUS SYS_accept SYS_fadvise64 diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index d2193b870516f..3ec327aec6337 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -2964,6 +2964,7 @@ SO_RXQ_OVFL SO_SNDBUFFORCE SO_TIMESTAMP SO_TIMESTAMPING +SO_TIMESTAMPNS SPLICE_F_GIFT SPLICE_F_MORE SPLICE_F_MOVE diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs index 10953fe789df3..ea38a20d67e40 100644 --- a/src/unix/linux_like/linux/arch/generic/mod.rs +++ b/src/unix/linux_like/linux/arch/generic/mod.rs @@ -40,10 +40,8 @@ pub const SO_PASSCRED: c_int = 16; pub const SO_PEERCRED: c_int = 17; pub const SO_RCVLOWAT: c_int = 18; pub const SO_SNDLOWAT: c_int = 19; -pub const SO_RCVTIMEO: c_int = 20; -pub const SO_SNDTIMEO: c_int = 21; -// pub const SO_RCVTIMEO_OLD: c_int = 20; -// pub const SO_SNDTIMEO_OLD: c_int = 21; +const SO_RCVTIMEO_OLD: c_int = 20; +const SO_SNDTIMEO_OLD: c_int = 21; pub const SO_SECURITY_AUTHENTICATION: c_int = 22; pub const SO_SECURITY_ENCRYPTION_TRANSPORT: c_int = 23; pub const SO_SECURITY_ENCRYPTION_NETWORK: c_int = 24; @@ -52,18 +50,35 @@ pub const SO_ATTACH_FILTER: c_int = 26; pub const SO_DETACH_FILTER: c_int = 27; pub const SO_GET_FILTER: c_int = SO_ATTACH_FILTER; pub const SO_PEERNAME: c_int = 28; -pub const SO_TIMESTAMP: c_int = 29; -// pub const SO_TIMESTAMP_OLD: c_int = 29; +const SO_TIMESTAMP_OLD: c_int = 29; +const SO_TIMESTAMPNS_OLD: c_int = 35; +const SO_TIMESTAMPING_OLD: c_int = 37; + +cfg_if! { + if #[cfg(all( + linux_time_bits64, + any(target_arch = "arm", target_arch = "x86") + ))] { + pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_NEW; + pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_NEW; + pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_NEW; + pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_NEW; + pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_NEW; + } else { + pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_OLD; + pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_OLD; + pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_OLD; + pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_OLD; + pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_OLD; + } +} + pub const SO_ACCEPTCONN: c_int = 30; pub const SO_PEERSEC: c_int = 31; pub const SO_SNDBUFFORCE: c_int = 32; pub const SO_RCVBUFFORCE: c_int = 33; pub const SO_PASSSEC: c_int = 34; -pub const SO_TIMESTAMPNS: c_int = 35; -// pub const SO_TIMESTAMPNS_OLD: c_int = 35; pub const SO_MARK: c_int = 36; -pub const SO_TIMESTAMPING: c_int = 37; -// pub const SO_TIMESTAMPING_OLD: c_int = 37; pub const SO_PROTOCOL: c_int = 38; pub const SO_DOMAIN: c_int = 39; pub const SO_RXQ_OVFL: c_int = 40; diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs index 950ad5f118dfb..2fcadc8004ea7 100644 --- a/src/unix/linux_like/linux/arch/mips/mod.rs +++ b/src/unix/linux_like/linux/arch/mips/mod.rs @@ -36,10 +36,17 @@ pub const SO_RCVLOWAT: c_int = 0x1004; // NOTE: These definitions are now being renamed with _OLD postfix, // but CI haven't support them yet. // Some related consts could be found in b32.rs and b64.rs -pub const SO_SNDTIMEO: c_int = 0x1005; -pub const SO_RCVTIMEO: c_int = 0x1006; -// pub const SO_SNDTIMEO_OLD: c_int = 0x1005; -// pub const SO_RCVTIMEO_OLD: c_int = 0x1006; +const SO_SNDTIMEO_OLD: c_int = 0x1005; +const SO_RCVTIMEO_OLD: c_int = 0x1006; +cfg_if! { + if #[cfg(linux_time_bits64)] { + pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_NEW; + pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_NEW; + } else { + pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_OLD; + pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_OLD; + } +} pub const SO_ACCEPTCONN: c_int = 0x1009; pub const SO_PROTOCOL: c_int = 0x1028; pub const SO_DOMAIN: c_int = 0x1029; @@ -91,17 +98,20 @@ pub const SO_BINDTOIFINDEX: c_int = 62; // NOTE: These definitions are now being renamed with _OLD postfix, // but CI haven't support them yet. // Some related consts could be found in b32.rs and b64.rs -pub const SO_TIMESTAMP: c_int = 29; -pub const SO_TIMESTAMPNS: c_int = 35; -pub const SO_TIMESTAMPING: c_int = 37; -// pub const SO_TIMESTAMP_OLD: c_int = 29; -// pub const SO_TIMESTAMPNS_OLD: c_int = 35; -// pub const SO_TIMESTAMPING_OLD: c_int = 37; -// pub const SO_TIMESTAMP_NEW: c_int = 63; -// pub const SO_TIMESTAMPNS_NEW: c_int = 64; -// pub const SO_TIMESTAMPING_NEW: c_int = 65; -// pub const SO_RCVTIMEO_NEW: c_int = 66; -// pub const SO_SNDTIMEO_NEW: c_int = 67; +const SO_TIMESTAMP_OLD: c_int = 29; +const SO_TIMESTAMPNS_OLD: c_int = 35; +const SO_TIMESTAMPING_OLD: c_int = 37; +cfg_if! { + if #[cfg(linux_time_bits64)] { + pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_NEW; + pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_NEW; + pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_NEW; + } else { + pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_OLD; + pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_OLD; + pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_OLD; + } +} // pub const SO_DETACH_REUSEPORT_BPF: c_int = 68; // pub const SO_PREFER_BUSY_POLL: c_int = 69; // pub const SO_BUSY_POLL_BUDGET: c_int = 70; diff --git a/src/unix/linux_like/linux/arch/powerpc/mod.rs b/src/unix/linux_like/linux/arch/powerpc/mod.rs index de39df0d8323a..2e8d3e3675393 100644 --- a/src/unix/linux_like/linux/arch/powerpc/mod.rs +++ b/src/unix/linux_like/linux/arch/powerpc/mod.rs @@ -24,8 +24,15 @@ pub const SO_REUSEPORT: c_int = 15; // powerpc only differs in these pub const SO_RCVLOWAT: c_int = 16; pub const SO_SNDLOWAT: c_int = 17; -pub const SO_RCVTIMEO: c_int = 18; -pub const SO_SNDTIMEO: c_int = 19; +cfg_if! { + if #[cfg(linux_time_bits64)] { + pub const SO_SNDTIMEO: c_int = 67; + pub const SO_RCVTIMEO: c_int = 66; + } else { + pub const SO_SNDTIMEO: c_int = 19; + pub const SO_RCVTIMEO: c_int = 18; + } +} // pub const SO_RCVTIMEO_OLD: c_int = 18; // pub const SO_SNDTIMEO_OLD: c_int = 19; pub const SO_PASSCRED: c_int = 20; @@ -39,18 +46,26 @@ pub const SO_ATTACH_FILTER: c_int = 26; pub const SO_DETACH_FILTER: c_int = 27; pub const SO_GET_FILTER: c_int = SO_ATTACH_FILTER; pub const SO_PEERNAME: c_int = 28; -pub const SO_TIMESTAMP: c_int = 29; -// pub const SO_TIMESTAMP_OLD: c_int = 29; +cfg_if! { + if #[cfg(linux_time_bits64)] { + pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_NEW; + pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_NEW; + pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_NEW; + } else { + pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_OLD; + pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_OLD; + pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_OLD; + } +} +const SO_TIMESTAMP_OLD: c_int = 29; +const SO_TIMESTAMPNS_OLD: c_int = 35; +const SO_TIMESTAMPING_OLD: c_int = 37; pub const SO_ACCEPTCONN: c_int = 30; pub const SO_PEERSEC: c_int = 31; pub const SO_SNDBUFFORCE: c_int = 32; pub const SO_RCVBUFFORCE: c_int = 33; pub const SO_PASSSEC: c_int = 34; -pub const SO_TIMESTAMPNS: c_int = 35; -// pub const SO_TIMESTAMPNS_OLD: c_int = 35; pub const SO_MARK: c_int = 36; -pub const SO_TIMESTAMPING: c_int = 37; -// pub const SO_TIMESTAMPING_OLD: c_int = 37; pub const SO_PROTOCOL: c_int = 38; pub const SO_DOMAIN: c_int = 39; pub const SO_RXQ_OVFL: c_int = 40; From 83d3f04b0393058a0de692965dea8fcb0c760e57 Mon Sep 17 00:00:00 2001 From: Ola x Nilsson Date: Wed, 20 Nov 2024 11:11:35 +0100 Subject: [PATCH 3/7] linux: Set RLIM_INFINITY for 32bit mips with __USE_TIME_BITS64 (backport ) (cherry picked from commit 125b4f715756b3f641a7178534fb9e2374ac1d90) --- src/unix/linux_like/linux/arch/mips/mod.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs index 2fcadc8004ea7..70364b3108cd4 100644 --- a/src/unix/linux_like/linux/arch/mips/mod.rs +++ b/src/unix/linux_like/linux/arch/mips/mod.rs @@ -359,10 +359,17 @@ cfg_if! { } cfg_if! { - if #[cfg( + if #[cfg(all( any(target_arch = "mips", target_arch = "mips32r6"), - any(target_env = "gnu", target_env = "uclibc") - )] { + any(target_env = "uclibc", target_env = "gnu"), + linux_time_bits64 + ))] { + pub const RLIM_INFINITY: crate::rlim_t = !0; + } else if #[cfg(all( + any(target_arch = "mips", target_arch = "mips32r6"), + any(target_env = "uclibc", target_env = "gnu"), + not(linux_time_bits64) + ))] { pub const RLIM_INFINITY: crate::rlim_t = 0x7fffffff; } } From 17553b760d19867dc67647b3ee377f294fb3ac3a Mon Sep 17 00:00:00 2001 From: Ola x Nilsson Date: Fri, 17 Mar 2023 15:21:05 +0100 Subject: [PATCH 4/7] linux: Update struct input_event for __USE_TIME_BITS64 (backport ) (cherry picked from commit 7413e22f250030596f75c294cff976af2d3dfed5) --- src/unix/linux_like/linux/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index c2fa6392fa500..71311c1ed6681 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -327,7 +327,21 @@ s! { } pub struct input_event { + // FIXME(1.0): Change to the commented variant, see https://github.com/rust-lang/libc/pull/4148#discussion_r1857511742 + #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))] pub time: crate::timeval, + // #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))] + // pub input_event_sec: time_t, + // #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))] + // pub input_event_usec: suseconds_t, + // #[cfg(target_arch = "sparc64")] + // _pad1: c_int, + #[cfg(all(target_pointer_width = "32", linux_time_bits64))] + pub input_event_sec: c_ulong, + + #[cfg(all(target_pointer_width = "32", linux_time_bits64))] + pub input_event_usec: c_ulong, + pub type_: __u16, pub code: __u16, pub value: __s32, From 72e58545718a7423154bd18f07a536d40b05bdc9 Mon Sep 17 00:00:00 2001 From: Ola x Nilsson Date: Tue, 26 Nov 2024 17:28:26 +0100 Subject: [PATCH 5/7] unix: Add FIXME(time) for struct timeval struct timeval has to be updated at least for glibc with _TIME_BITS=64. (backport ) (cherry picked from commit c20130256eaa9e650beeffc1dc0b8ab0215aae2f) --- src/unix/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 65c426c181aef..1e70238d19824 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -56,6 +56,7 @@ s! { pub modtime: time_t, } + // FIXME(time): Needs updates at least for glibc _TIME_BITS=64 pub struct timeval { pub tv_sec: time_t, pub tv_usec: suseconds_t, From c5b746547116aef22ef4c01ccf2e626c36f0cee7 Mon Sep 17 00:00:00 2001 From: Ola x Nilsson Date: Mon, 27 Jan 2025 09:53:12 +0100 Subject: [PATCH 6/7] Rerun build if RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64 changes Collect the linux_time_bits64 in one place. (backport ) (cherry picked from commit 9a861ed61c696761c18037ad6255176409bf43fe) --- build.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 2487f89e71563..3439208f7e2ce 100644 --- a/build.rs +++ b/build.rs @@ -45,7 +45,6 @@ fn main() { 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; - let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok(); // 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. @@ -82,6 +81,8 @@ fn main() { _ => (), } + let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok(); + println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64"); if linux_time_bits64 { set_cfg("linux_time_bits64"); } From 8b0ab163062c7495f1fba755c9a782e58e94fc57 Mon Sep 17 00:00:00 2001 From: Ola x Nilsson Date: Mon, 16 Dec 2024 09:21:06 +0100 Subject: [PATCH 7/7] Add forgotten SO_*_NEW values to powerpc, mips and arm The _NEW defines are not available in musl and ohos. (backport ) (cherry picked from commit b0e68783fa8f4b91b6a1fa03fe7d4b1ebb8ed015) --- src/unix/linux_like/linux/arch/generic/mod.rs | 14 +++++++++++++- src/unix/linux_like/linux/arch/mips/mod.rs | 5 +++++ src/unix/linux_like/linux/arch/powerpc/mod.rs | 10 +++++----- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs index ea38a20d67e40..098c83c3b885b 100644 --- a/src/unix/linux_like/linux/arch/generic/mod.rs +++ b/src/unix/linux_like/linux/arch/generic/mod.rs @@ -57,13 +57,24 @@ const SO_TIMESTAMPING_OLD: c_int = 37; cfg_if! { if #[cfg(all( linux_time_bits64, - any(target_arch = "arm", target_arch = "x86") + any(target_arch = "arm", target_arch = "x86"), + not(any(target_env = "musl", target_env = "ohos")) ))] { pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_NEW; pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_NEW; pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_NEW; pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_NEW; pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_NEW; + } else if #[cfg(all( + linux_time_bits64, + any(target_arch = "arm", target_arch = "x86"), + any(target_env = "musl", target_env = "ohos") + ))] { + pub const SO_TIMESTAMP: c_int = 63; + pub const SO_TIMESTAMPNS: c_int = 64; + pub const SO_TIMESTAMPING: c_int = 65; + pub const SO_RCVTIMEO: c_int = 66; + pub const SO_SNDTIMEO: c_int = 67; } else { pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_OLD; pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_OLD; @@ -114,6 +125,7 @@ cfg_if! { any( target_arch = "x86", target_arch = "x86_64", + target_arch = "arm", target_arch = "aarch64", target_arch = "csky", target_arch = "loongarch64" diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs index 70364b3108cd4..612f8c73ffc3c 100644 --- a/src/unix/linux_like/linux/arch/mips/mod.rs +++ b/src/unix/linux_like/linux/arch/mips/mod.rs @@ -99,8 +99,13 @@ pub const SO_BINDTOIFINDEX: c_int = 62; // but CI haven't support them yet. // Some related consts could be found in b32.rs and b64.rs const SO_TIMESTAMP_OLD: c_int = 29; +const SO_RCVTIMEO_NEW: c_int = 66; +const SO_SNDTIMEO_NEW: c_int = 67; const SO_TIMESTAMPNS_OLD: c_int = 35; const SO_TIMESTAMPING_OLD: c_int = 37; +const SO_TIMESTAMP_NEW: c_int = 63; +const SO_TIMESTAMPNS_NEW: c_int = 64; +const SO_TIMESTAMPING_NEW: c_int = 65; cfg_if! { if #[cfg(linux_time_bits64)] { pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_NEW; diff --git a/src/unix/linux_like/linux/arch/powerpc/mod.rs b/src/unix/linux_like/linux/arch/powerpc/mod.rs index 2e8d3e3675393..50d1ef17bb887 100644 --- a/src/unix/linux_like/linux/arch/powerpc/mod.rs +++ b/src/unix/linux_like/linux/arch/powerpc/mod.rs @@ -94,11 +94,11 @@ pub const SO_ZEROCOPY: c_int = 60; pub const SO_TXTIME: c_int = 61; pub const SCM_TXTIME: c_int = SO_TXTIME; pub const SO_BINDTOIFINDEX: c_int = 62; -// pub const SO_TIMESTAMP_NEW: c_int = 63; -// pub const SO_TIMESTAMPNS_NEW: c_int = 64; -// pub const SO_TIMESTAMPING_NEW: c_int = 65; -// pub const SO_RCVTIMEO_NEW: c_int = 66; -// pub const SO_SNDTIMEO_NEW: c_int = 67; +const SO_TIMESTAMP_NEW: c_int = 63; +const SO_TIMESTAMPNS_NEW: c_int = 64; +const SO_TIMESTAMPING_NEW: c_int = 65; +const SO_RCVTIMEO_NEW: c_int = 66; +const SO_SNDTIMEO_NEW: c_int = 67; // pub const SO_DETACH_REUSEPORT_BPF: c_int = 68; // pub const SO_PREFER_BUSY_POLL: c_int = 69; // pub const SO_BUSY_POLL_BUDGET: c_int = 70;