Skip to content

Commit fb58c01

Browse files
tammelatgross35
authored andcommitted
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. The ioctls constants are padded to 64 bits alignment even on 32 bits machines. Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
1 parent 613b81f commit fb58c01

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

libc-test/build.rs

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

3842+
// FIXME: Requires >= 6.9 kernel headers.
3843+
"epoll_params" => true,
3844+
38423845
_ => false,
38433846
}
38443847
});
@@ -4287,6 +4290,10 @@ fn test_linux(target: &str) {
42874290
| "SCHED_FLAG_UTIL_CLAMP"
42884291
| "SCHED_FLAG_ALL" if musl => true, // Needs more recent linux headers.
42894292

4293+
// FIXME: Requires >= 6.9 kernel headers.
4294+
"EPIOCSPARAMS"
4295+
| "EPIOCGPARAMS" => true,
4296+
42904297
_ => false,
42914298
}
42924299
});

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/mod.rs

Lines changed: 13 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! {
@@ -5172,6 +5181,10 @@ pub const SCHED_FLAG_ALL: ::c_int = SCHED_FLAG_RESET_ON_FORK
51725181
| SCHED_FLAG_KEEP_ALL
51735182
| SCHED_FLAG_UTIL_CLAMP;
51745183

5184+
// ioctl_eventpoll: added in Linux 6.9
5185+
pub const EPIOCSPARAMS: ::Ioctl = 0x40088a01;
5186+
pub const EPIOCGPARAMS: ::Ioctl = 0x80088a02;
5187+
51755188
f! {
51765189
pub fn NLA_ALIGN(len: ::c_int) -> ::c_int {
51775190
return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1)

0 commit comments

Comments
 (0)