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 2ce09ed168df8..71f4bbf04cb35 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;