Skip to content

Commit

Permalink
Add iopl/ioperm to musl x86_64
Browse files Browse the repository at this point in the history
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.

(backport <rust-lang#3720>)
(cherry picked from commit 083499a)
  • Loading branch information
espindola authored and tgross35 committed Oct 15, 2024
1 parent 1447f78 commit f0422d5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions libc-test/semver/linux-i686.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ fsblkcnt64_t
fsfilcnt64_t
getcontext
greg_t
ioperm
iopl
makecontext
max_align_t
mcontext_t
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/linux-x86_64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ TIOCGRS485
TIOCSBRK
TIOCSRS485
greg_t
ioperm
iopl
max_align_t
mcontext_t
ucontext_t
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down
10 changes: 10 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1556,6 +1556,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;
Expand Down

0 comments on commit f0422d5

Please sign in to comment.