diff --git a/src/unix/apple/cpu.rs b/src/unix/apple/cpu.rs index 7fd63ef84..c366cba4d 100644 --- a/src/unix/apple/cpu.rs +++ b/src/unix/apple/cpu.rs @@ -3,7 +3,9 @@ use crate::sys::utils::{get_sys_value, get_sys_value_by_name}; use crate::{Cpu, CpuRefreshKind}; -use libc::{c_char, c_void, host_processor_info, mach_port_t, mach_task_self}; +#[allow(deprecated)] +use libc::mach_task_self; +use libc::{c_char, c_void, host_processor_info, mach_port_t}; use std::mem; use std::ops::Deref; use std::sync::Arc; @@ -97,6 +99,7 @@ impl Drop for CpuData { let prev_cpu_info_size = std::mem::size_of::() as u32 * self.num_cpu_info; unsafe { libc::vm_deallocate( + #[allow(deprecated)] mach_task_self(), self.cpu_info.0 as _, prev_cpu_info_size as _, diff --git a/src/unix/apple/macos/component/x86.rs b/src/unix/apple/macos/component/x86.rs index ef34329ae..51aca60a8 100644 --- a/src/unix/apple/macos/component/x86.rs +++ b/src/unix/apple/macos/component/x86.rs @@ -321,7 +321,13 @@ impl IoService { }; let mut conn = 0; - let result = ffi::IOServiceOpen(device.inner(), libc::mach_task_self(), 0, &mut conn); + let result = ffi::IOServiceOpen( + device.inner(), + #[allow(deprecated)] + libc::mach_task_self(), + 0, + &mut conn, + ); if result != ffi::KIO_RETURN_SUCCESS { sysinfo_debug!("Error: IOServiceOpen() = {}", result); return None; diff --git a/src/unix/apple/macos/system.rs b/src/unix/apple/macos/system.rs index 6c182ae1f..e2c934982 100644 --- a/src/unix/apple/macos/system.rs +++ b/src/unix/apple/macos/system.rs @@ -162,6 +162,7 @@ mod test { return; } + #[allow(deprecated)] let port = unsafe { libc::mach_host_self() }; let mut info = SystemTimeInfo::new(port).unwrap(); info.get_time_interval(port); diff --git a/src/unix/apple/system.rs b/src/unix/apple/system.rs index 47c3a7eec..d70ef228a 100644 --- a/src/unix/apple/system.rs +++ b/src/unix/apple/system.rs @@ -129,6 +129,7 @@ fn get_now() -> u64 { impl SystemInner { pub(crate) fn new() -> Self { unsafe { + #[allow(deprecated)] let port = libc::mach_host_self(); Self {