Skip to content

Commit 73f264c

Browse files
committed
linux: Correct the value of EPIOC[GS]PARAMS with nonstandard _IOC
PowerPC, Sparc, and MIPS (32- and 64-bit for all) have different `_IOC` numbers, meaning the constants were inaccurate. Example error on PowerPC64: bad `EPIOCSPARAMS` value at byte 4: rust: 64 (0x40) != c 128 (0x80) rust bytes: 00 00 00 00 40 08 8a 01 c bytes: 00 00 00 00 80 08 8a 01 bad `EPIOCGPARAMS` value at byte 4: rust: 128 (0x80) != c 64 (0x40) rust bytes: 00 00 00 00 80 08 8a 02 c bytes: 00 00 00 00 40 08 8a 02 Resolve this by using `_IOW` and `_IOR`. Source: https://github.com/torvalds/linux/blob/502d801f0ab03e4f32f9a33d203154ce84887921/include/uapi/linux/eventpoll.h#L97-L99 Fixes: fb58c01 ("epoll: add busy polling parameters")
1 parent ccadc03 commit 73f264c

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

libc-test/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3823,7 +3823,7 @@ fn test_linux(target: &str) {
38233823
let mips64 = target.contains("mips64");
38243824
let mips32 = mips && !mips64;
38253825
let versions = &*VERSIONS;
3826-
let kernel = versions.linux.unwrap_or((0, 0));
3826+
let kernel = versions.linux.unwrap();
38273827

38283828
let musl_v1_2_3 = env::var("CARGO_CFG_LIBC_UNSTABLE_MUSL_V1_2_3").is_ok();
38293829
if musl_v1_2_3 {

src/unix/linux_like/linux/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3649,8 +3649,9 @@ pub const SCHED_FLAG_ALL: c_int = SCHED_FLAG_RESET_ON_FORK
36493649
| SCHED_FLAG_UTIL_CLAMP;
36503650

36513651
// ioctl_eventpoll: added in Linux 6.9
3652-
pub const EPIOCSPARAMS: Ioctl = 0x40088a01;
3653-
pub const EPIOCGPARAMS: Ioctl = u32_cast_ioctl(0x80088a02);
3652+
const EPOLL_IOC_TYPE: u32 = 0x8A;
3653+
pub const EPIOCSPARAMS: Ioctl = _IOW::<epoll_params>(EPOLL_IOC_TYPE, 0x01);
3654+
pub const EPIOCGPARAMS: Ioctl = _IOR::<epoll_params>(EPOLL_IOC_TYPE, 0x02);
36543655

36553656
// siginfo.h
36563657
pub const SI_DETHREAD: c_int = -7;

0 commit comments

Comments
 (0)