1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

chore: upgrade libc (#27414)

need to do this for quic and they deprecated this method in libc without
actually providing an alternative so :/
This commit is contained in:
snek 2024-12-18 14:47:21 +01:00 committed by GitHub
parent 8590aa9cee
commit ae74407412
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 19 additions and 7 deletions

4
Cargo.lock generated
View file

@ -4552,9 +4552,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.153"
version = "0.2.168"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d"
[[package]]
name = "libffi"

View file

@ -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

View file

@ -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,
@ -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 _,
);

View file

@ -424,8 +424,11 @@ fn rss() -> usize {
let mut count = libc::MACH_TASK_BASIC_INFO_COUNT;
// SAFETY: libc calls
let r = unsafe {
extern "C" {
static mut mach_task_self_: std::ffi::c_uint;
}
libc::task_info(
libc::mach_task_self(),
mach_task_self_,
libc::MACH_TASK_BASIC_INFO,
task_info.as_mut_ptr() as libc::task_info_t,
&mut count as *mut libc::mach_msg_type_number_t,

View file

@ -278,11 +278,15 @@ pub fn mem_info() -> Option<MemInfo> {
mem_info.swap_total = xs.xsu_total;
mem_info.swap_free = xs.xsu_avail;
extern "C" {
fn mach_host_self() -> std::ffi::c_uint;
}
let mut count: u32 = libc::HOST_VM_INFO64_COUNT as _;
let mut stat = std::mem::zeroed::<libc::vm_statistics64>();
if libc::host_statistics64(
// TODO(@littledivy): Put this in a once_cell.
libc::mach_host_self(),
mach_host_self(),
libc::HOST_VM_INFO64,
&mut stat as *mut libc::vm_statistics64 as *mut _,
&mut count,