From b3884fb8bfdb17bd911de42ad46d7f46f8700c8c Mon Sep 17 00:00:00 2001 From: Pedro Tammela Date: Thu, 21 Nov 2024 13:06:04 -0300 Subject: [PATCH] Add SO_PREFER_BUSY_POLL and SO_BUSY_POLL_BUDGET Remove the comment of these socket options. Reference: https://elixir.bootlin.com/linux/latest/source/include/uapi/asm-generic/socket.h Note, musl hardcodes 'SO_*' constants instead of inheriting them from the OS. Signed-off-by: Pedro Tammela --- libc-test/build.rs | 6 ++++++ libc-test/semver/linux.txt | 2 ++ src/unix/linux_like/linux/arch/generic/mod.rs | 9 +++++++-- src/unix/linux_like/linux/arch/mips/mod.rs | 4 ++-- src/unix/linux_like/linux/arch/powerpc/mod.rs | 4 ++-- src/unix/linux_like/linux/arch/sparc/mod.rs | 4 ++-- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index fc54b662d1247..e858504efc0fc 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3964,6 +3964,12 @@ fn test_linux(target: &str) { if loongarch64 && (name == "MFD_NOEXEC_SEAL" || name == "MFD_EXEC") { return true; } + // FIXME(musl): Requires musl >= 1.2 + if name == "SO_PREFER_BUSY_POLL" + || name == "SO_BUSY_POLL_BUDGET" + { + return true; + } } match name { // These constants are not available if gnu headers have been included diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 013d02e850b22..37b0243a7065e 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -2895,6 +2895,7 @@ SOL_X25 SOMAXCONN SO_BINDTODEVICE SO_BUSY_POLL +SO_BUSY_POLL_BUDGET SO_DOMAIN SO_EE_OFFENDER SO_EE_ORIGIN_ICMP @@ -2914,6 +2915,7 @@ SO_PASSSEC SO_PEEK_OFF SO_PEERCRED SO_PEERSEC +SO_PREFER_BUSY_POLL SO_RCVBUFFORCE SO_REUSEPORT SO_RXQ_OVFL diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs index 3e7d3a1117d52..4f9d342488208 100644 --- a/src/unix/linux_like/linux/arch/generic/mod.rs +++ b/src/unix/linux_like/linux/arch/generic/mod.rs @@ -102,6 +102,11 @@ cfg_if! { target_arch = "csky", target_arch = "loongarch64" ), + // FIXME(musl): + // Musl hardcodes the SO_* constants instead + // of inheriting them from the kernel headers. + // For new constants you might need consider updating + // musl in the CI as well. not(any(target_env = "musl", target_env = "ohos")) ))] { pub const SO_TIMESTAMP_NEW: c_int = 63; @@ -112,8 +117,8 @@ cfg_if! { 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; +pub const SO_PREFER_BUSY_POLL: c_int = 69; +pub const SO_BUSY_POLL_BUDGET: c_int = 70; cfg_if! { if #[cfg(any( diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs index 52469befdccc0..76c55de30d9e4 100644 --- a/src/unix/linux_like/linux/arch/mips/mod.rs +++ b/src/unix/linux_like/linux/arch/mips/mod.rs @@ -102,8 +102,8 @@ pub const SO_TIMESTAMPING: c_int = 37; // pub const SO_RCVTIMEO_NEW: c_int = 66; // pub 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; +pub const SO_PREFER_BUSY_POLL: c_int = 69; +pub const SO_BUSY_POLL_BUDGET: c_int = 70; pub const FICLONE: c_ulong = 0x80049409; pub const FICLONERANGE: c_ulong = 0x8020940D; diff --git a/src/unix/linux_like/linux/arch/powerpc/mod.rs b/src/unix/linux_like/linux/arch/powerpc/mod.rs index 2c856061d3391..fc8326d22d109 100644 --- a/src/unix/linux_like/linux/arch/powerpc/mod.rs +++ b/src/unix/linux_like/linux/arch/powerpc/mod.rs @@ -84,8 +84,8 @@ pub const SO_BINDTOIFINDEX: c_int = 62; // pub const SO_RCVTIMEO_NEW: c_int = 66; // pub 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; +pub const SO_PREFER_BUSY_POLL: c_int = 69; +pub const SO_BUSY_POLL_BUDGET: c_int = 70; pub const FICLONE: c_ulong = 0x80049409; pub const FICLONERANGE: c_ulong = 0x8020940D; diff --git a/src/unix/linux_like/linux/arch/sparc/mod.rs b/src/unix/linux_like/linux/arch/sparc/mod.rs index 40454fde34f5d..f34f6e02998e4 100644 --- a/src/unix/linux_like/linux/arch/sparc/mod.rs +++ b/src/unix/linux_like/linux/arch/sparc/mod.rs @@ -94,8 +94,8 @@ pub const SO_TIMESTAMPING: c_int = 0x0023; // pub const SO_RCVTIMEO_NEW: c_int = 0x0044; // pub const SO_SNDTIMEO_NEW: c_int = 0x0045; // pub const SO_DETACH_REUSEPORT_BPF: c_int = 0x0047; -// pub const SO_PREFER_BUSY_POLL: c_int = 0x0048; -// pub const SO_BUSY_POLL_BUDGET: c_int = 0x0049; +pub const SO_PREFER_BUSY_POLL: c_int = 0x0048; +pub const SO_BUSY_POLL_BUDGET: c_int = 0x0049; // Defined in unix/linux_like/mod.rs // pub const SCM_TIMESTAMP: c_int = SO_TIMESTAMP;