Skip to content

Commit bcae06e

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> (backport <#3922>) (cherry picked from commit fb58c01) Signed-off-by: Trevor Gross <tmgross@umich.edu>
1 parent b0dd5ff commit bcae06e

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
@@ -3864,6 +3864,9 @@ fn test_linux(target: &str) {
38643864
// kernel so we can drop this and test the type once this new version is used in CI.
38653865
"sched_attr" => true,
38663866

3867+
// FIXME: Requires >= 6.9 kernel headers.
3868+
"epoll_params" => true,
3869+
38673870
_ => false,
38683871
}
38693872
});
@@ -4306,6 +4309,10 @@ fn test_linux(target: &str) {
43064309
| "SCHED_FLAG_UTIL_CLAMP"
43074310
| "SCHED_FLAG_ALL" if musl => true, // Needs more recent linux headers.
43084311

4312+
// FIXME: Requires >= 6.9 kernel headers.
4313+
"EPIOCSPARAMS"
4314+
| "EPIOCGPARAMS" => true,
4315+
43094316
_ => false,
43104317
}
43114318
});

libc-test/semver/linux.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,8 @@ ENOTSUP
550550
ENOTUNIQ
551551
EOF
552552
EOWNERDEAD
553+
EPIOCGPARAMS
554+
EPIOCSPARAMS
553555
EPOLLERR
554556
EPOLLET
555557
EPOLLEXCLUSIVE
@@ -3489,6 +3491,7 @@ epoll_create
34893491
epoll_create1
34903492
epoll_ctl
34913493
epoll_event
3494+
epoll_params
34923495
epoll_pwait
34933496
epoll_wait
34943497
erand48

src/unix/linux_like/linux/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,15 @@ s! {
880880
pub salt: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE],
881881
pub rec_seq: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE],
882882
}
883+
884+
// #include <linux/eventpoll.h>
885+
886+
pub struct epoll_params {
887+
pub busy_poll_usecs: u32,
888+
pub busy_poll_budget: u16,
889+
pub prefer_busy_poll: u8,
890+
pub __pad: u8, // Must be zero
891+
}
883892
}
884893

885894
s_no_extra_traits! {
@@ -4936,6 +4945,10 @@ pub const SCHED_FLAG_ALL: ::c_int = SCHED_FLAG_RESET_ON_FORK
49364945
| SCHED_FLAG_KEEP_ALL
49374946
| SCHED_FLAG_UTIL_CLAMP;
49384947

4948+
// ioctl_eventpoll: added in Linux 6.9
4949+
pub const EPIOCSPARAMS: ::Ioctl = 0x40088a01;
4950+
pub const EPIOCGPARAMS: ::Ioctl = 0x80088a02;
4951+
49394952
f! {
49404953
pub fn NLA_ALIGN(len: ::c_int) -> ::c_int {
49414954
return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1)

0 commit comments

Comments
 (0)