Skip to content

Commit

Permalink
chore: upgrade libc
Browse files Browse the repository at this point in the history
  • Loading branch information
devsnek committed Dec 18, 2024
1 parent 14e4064 commit 58a447c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ indexmap = { version = "2", features = ["serde"] }
ipnet = "2.3"
jsonc-parser = { version = "=0.26.2", features = ["serde"] }
lazy-regex = "3"
libc = "0.2.126"
libc = "0.2.168"
libz-sys = { version = "1.1.20", default-features = false }
log = { version = "0.4.20", features = ["kv"] }
lsp-types = "=0.97.0" # used by tower-lsp and "proposed" feature is unstable in patch releases
Expand Down
9 changes: 7 additions & 2 deletions ext/node/ops/os/cpus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,17 @@ pub fn cpu_info() -> Option<Vec<CpuInfo>> {
cpu_speed = 2_400_000_000;
}

extern "C" {
fn mach_host_self() -> std::ffi::c_uint;
static mut mach_task_self_: std::ffi::c_uint;
}

let mut num_cpus: libc::natural_t = 0;
let mut info: *mut libc::processor_cpu_load_info_data_t =
std::ptr::null_mut();
let mut msg_type: libc::mach_msg_type_number_t = 0;
if libc::host_processor_info(
libc::mach_host_self(),
mach_host_self(),
libc::PROCESSOR_CPU_LOAD_INFO,
&mut num_cpus,
&mut info as *mut _ as *mut libc::processor_info_array_t,
Expand Down Expand Up @@ -111,7 +116,7 @@ pub fn cpu_info() -> Option<Vec<CpuInfo>> {
}

libc::vm_deallocate(
libc::mach_task_self(),
mach_task_self_,
info.as_ptr() as libc::vm_address_t,
msg_type as _,
);
Expand Down

0 comments on commit 58a447c

Please sign in to comment.