Skip to content

Commit 810aa44

Browse files
committed
epoll: add busy polling parameters
In Linux 6.9 a new ioctl for epoll was added: https://man.archlinux.org/man/ioctl_eventpoll.2.en Add support for it Signed-off-by: Pedro Tammela <[email protected]>
1 parent 2c0250f commit 810aa44

4 files changed

Lines changed: 23 additions & 0 deletions

File tree

libc-test/build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3806,6 +3806,9 @@ fn test_linux(target: &str) {
38063806
// kernel so we can drop this and test the type once this new version is used in CI.
38073807
"sched_attr" => true,
38083808

3809+
// FIXME: Requires >= 6.9 kernel headers.
3810+
"epoll_params" => true,
3811+
38093812
_ => false,
38103813
}
38113814
});
@@ -4254,6 +4257,10 @@ fn test_linux(target: &str) {
42544257
| "SCHED_FLAG_UTIL_CLAMP"
42554258
| "SCHED_FLAG_ALL" if musl => true, // Needs more recent linux headers.
42564259

4260+
// FIXME: Requires >= 6.9 kernel headers.
4261+
"EPIOCSPARAMS"
4262+
| "EPIOCGPARAMS" => true,
4263+
42574264
_ => false,
42584265
}
42594266
});

libc-test/semver/linux.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,8 @@ ENOTSUP
556556
ENOTUNIQ
557557
EOF
558558
EOWNERDEAD
559+
EPIOCGPARAMS
560+
EPIOCSPARAMS
559561
EPOLLERR
560562
EPOLLET
561563
EPOLLEXCLUSIVE
@@ -3532,6 +3534,7 @@ epoll_create
35323534
epoll_create1
35333535
epoll_ctl
35343536
epoll_event
3537+
epoll_params
35353538
epoll_pwait
35363539
epoll_wait
35373540
erand48

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ cfg_if! {
243243
}
244244
}
245245

246+
// ioctl_eventpoll: added in Linux 6.9
247+
pub const EPIOCSPARAMS: ::Ioctl = 0x40088a01;
248+
pub const EPIOCGPARAMS: ::Ioctl = 0x80088a02;
249+
246250
cfg_if! {
247251
if #[cfg(any(target_arch = "arm",
248252
target_arch = "s390x"))] {

src/unix/linux_like/linux/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,15 @@ s! {
10361036
pub get_args: __u16,
10371037
pub name: [c_char; ::IFNAMSIZ],
10381038
}
1039+
1040+
// #include <linux/eventpoll.h>
1041+
1042+
pub struct epoll_params {
1043+
pub busy_poll_usecs: u32,
1044+
pub busy_poll_budget: u16,
1045+
pub prefer_busy_poll: u8,
1046+
pub __pad: u8, // Must be zero
1047+
}
10391048
}
10401049

10411050
cfg_if! {

0 commit comments

Comments
 (0)