Skip to content

Commit

Permalink
add support for env
Browse files Browse the repository at this point in the history
  • Loading branch information
LuuuXXX committed Nov 18, 2024
1 parent 875564c commit aca413f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions perf-event-open-sys/src/bindings_x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#![allow(non_snake_case)]
#![allow(deref_nullptr)] // `bindgen_test_layout` tests use bogus code
#![allow(clippy::all)]
#![allow(unsafe_op_in_unsafe_fn)]

/* automatically generated by rust-bindgen 0.69.4 */

Expand Down
7 changes: 5 additions & 2 deletions perf-event-open-sys/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
//! This module is only compiled on Linux. The `bindings` declarations
//! are useful on other platforms for parsing perf files.
#![allow(unsafe_op_in_unsafe_fn)]
#![allow(unused_imports)]

use crate::bindings;

use libc::pid_t;
Expand Down Expand Up @@ -97,10 +100,10 @@ pub mod ioctls {
}

unsafe fn untyped_ioctl<A>(fd: c_int, ioctl: bindings::perf_event_ioctls, arg: A) -> c_int {
#[cfg(any(target_env = "musl", target_os = "android"))]
#[cfg(any(target_env = "musl", target_env = "ohos", target_os = "android"))]
return libc::ioctl(fd, ioctl as c_int, arg);

#[cfg(not(any(target_env = "musl", target_os = "android")))]
#[cfg(not(any(target_env = "musl", target_env = "ohos", target_os = "android")))]
libc::ioctl(fd, ioctl as c_ulong, arg)
}
}

0 comments on commit aca413f

Please sign in to comment.