From 34a6d1021ab6f4acce006777c16a74c93a98db2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Fri, 24 May 2024 15:17:34 +0000 Subject: [PATCH] Add iopl/ioperm to musl x86_64 Note that I think this is available on more than x86_64, but that is all that I have to test. This also matches what was done for glibc systems. --- libc-test/semver/linux-i686.txt | 2 ++ libc-test/semver/linux-x86_64.txt | 2 ++ src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs | 2 -- src/unix/linux_like/linux/mod.rs | 10 ++++++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libc-test/semver/linux-i686.txt b/libc-test/semver/linux-i686.txt index aa379e1dcec62..8d1c48b82ce94 100644 --- a/libc-test/semver/linux-i686.txt +++ b/libc-test/semver/linux-i686.txt @@ -215,6 +215,8 @@ fsblkcnt64_t fsfilcnt64_t getcontext greg_t +ioperm +iopl makecontext max_align_t mcontext_t diff --git a/libc-test/semver/linux-x86_64.txt b/libc-test/semver/linux-x86_64.txt index 8ae1037764e84..8142fdf548b20 100644 --- a/libc-test/semver/linux-x86_64.txt +++ b/libc-test/semver/linux-x86_64.txt @@ -140,6 +140,8 @@ TIOCGRS485 TIOCSBRK TIOCSRS485 greg_t +ioperm +iopl max_align_t mcontext_t ucontext_t diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs index 86536f185750f..88d70d7deb5da 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs @@ -802,8 +802,6 @@ extern "C" { pub fn setcontext(ucp: *const ucontext_t) -> ::c_int; pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: ::c_int, ...); pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int; - pub fn iopl(level: ::c_int) -> ::c_int; - pub fn ioperm(from: ::c_ulong, num: ::c_ulong, turn_on: ::c_int) -> ::c_int; } cfg_if! { diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index ba68965174c09..182a2a7f0f124 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1777,6 +1777,16 @@ cfg_if! { } } +cfg_if! { + if #[cfg(all(any(target_env = "gnu", target_env = "musl", target_env = "ohos"), + any(target_arch = "x86_64", target_arch = "x86")))] { + extern "C" { + pub fn iopl(level: ::c_int) -> ::c_int; + pub fn ioperm(from: ::c_ulong, num: ::c_ulong, turn_on: ::c_int) -> ::c_int; + } + } +} + cfg_if! { if #[cfg(any(target_env = "gnu", target_env = "musl", target_env = "ohos"))] { pub const ABDAY_1: ::nl_item = 0x20000;