Skip to content

Commit 75542bc

Browse files
authored
Merge pull request #3917 from tammela/patch-1
Add SO_PREFER_BUSY_POLL and SO_BUSY_POLL_BUDGET
2 parents db220c9 + b3884fb commit 75542bc

File tree

6 files changed

+21
-8
lines changed

6 files changed

+21
-8
lines changed

libc-test/build.rs

+6
Original file line numberDiff line numberDiff line change
@@ -3989,6 +3989,12 @@ fn test_linux(target: &str) {
39893989
if loongarch64 && (name == "MFD_NOEXEC_SEAL" || name == "MFD_EXEC") {
39903990
return true;
39913991
}
3992+
// FIXME(musl): Requires musl >= 1.2
3993+
if name == "SO_PREFER_BUSY_POLL"
3994+
|| name == "SO_BUSY_POLL_BUDGET"
3995+
{
3996+
return true;
3997+
}
39923998
}
39933999
match name {
39944000
// These constants are not available if gnu headers have been included

libc-test/semver/linux.txt

+2
Original file line numberDiff line numberDiff line change
@@ -2954,6 +2954,7 @@ SOL_XDP
29542954
SOMAXCONN
29552955
SO_BINDTODEVICE
29562956
SO_BUSY_POLL
2957+
SO_BUSY_POLL_BUDGET
29572958
SO_DOMAIN
29582959
SO_EE_OFFENDER
29592960
SO_EE_ORIGIN_ICMP
@@ -2973,6 +2974,7 @@ SO_PASSSEC
29732974
SO_PEEK_OFF
29742975
SO_PEERCRED
29752976
SO_PEERSEC
2977+
SO_PREFER_BUSY_POLL
29762978
SO_RCVBUFFORCE
29772979
SO_REUSEPORT
29782980
SO_RXQ_OVFL

src/unix/linux_like/linux/arch/generic/mod.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ cfg_if! {
130130
target_arch = "csky",
131131
target_arch = "loongarch64"
132132
),
133+
// FIXME(musl):
134+
// Musl hardcodes the SO_* constants instead
135+
// of inheriting them from the kernel headers.
136+
// For new constants you might need consider updating
137+
// musl in the CI as well.
133138
not(any(target_env = "musl", target_env = "ohos"))
134139
))] {
135140
pub const SO_TIMESTAMP_NEW: c_int = 63;
@@ -140,8 +145,8 @@ cfg_if! {
140145
pub const SO_DETACH_REUSEPORT_BPF: c_int = 68;
141146
}
142147
}
143-
// pub const SO_PREFER_BUSY_POLL: c_int = 69;
144-
// pub const SO_BUSY_POLL_BUDGET: c_int = 70;
148+
pub const SO_PREFER_BUSY_POLL: c_int = 69;
149+
pub const SO_BUSY_POLL_BUDGET: c_int = 70;
145150

146151
cfg_if! {
147152
if #[cfg(any(

src/unix/linux_like/linux/arch/mips/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ cfg_if! {
118118
}
119119
}
120120
// pub const SO_DETACH_REUSEPORT_BPF: c_int = 68;
121-
// pub const SO_PREFER_BUSY_POLL: c_int = 69;
122-
// pub const SO_BUSY_POLL_BUDGET: c_int = 70;
121+
pub const SO_PREFER_BUSY_POLL: c_int = 69;
122+
pub const SO_BUSY_POLL_BUDGET: c_int = 70;
123123

124124
pub const FICLONE: c_ulong = 0x80049409;
125125
pub const FICLONERANGE: c_ulong = 0x8020940D;

src/unix/linux_like/linux/arch/powerpc/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ const SO_TIMESTAMPING_NEW: c_int = 65;
100100
const SO_RCVTIMEO_NEW: c_int = 66;
101101
const SO_SNDTIMEO_NEW: c_int = 67;
102102
// pub const SO_DETACH_REUSEPORT_BPF: c_int = 68;
103-
// pub const SO_PREFER_BUSY_POLL: c_int = 69;
104-
// pub const SO_BUSY_POLL_BUDGET: c_int = 70;
103+
pub const SO_PREFER_BUSY_POLL: c_int = 69;
104+
pub const SO_BUSY_POLL_BUDGET: c_int = 70;
105105

106106
pub const FICLONE: c_ulong = 0x80049409;
107107
pub const FICLONERANGE: c_ulong = 0x8020940D;

src/unix/linux_like/linux/arch/sparc/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ pub const SO_TIMESTAMPING: c_int = 0x0023;
9595
// pub const SO_RCVTIMEO_NEW: c_int = 0x0044;
9696
// pub const SO_SNDTIMEO_NEW: c_int = 0x0045;
9797
// pub const SO_DETACH_REUSEPORT_BPF: c_int = 0x0047;
98-
// pub const SO_PREFER_BUSY_POLL: c_int = 0x0048;
99-
// pub const SO_BUSY_POLL_BUDGET: c_int = 0x0049;
98+
pub const SO_PREFER_BUSY_POLL: c_int = 0x0048;
99+
pub const SO_BUSY_POLL_BUDGET: c_int = 0x0049;
100100

101101
// Defined in unix/linux_like/mod.rs
102102
// pub const SCM_TIMESTAMP: c_int = SO_TIMESTAMP;

0 commit comments

Comments
 (0)