mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Use mallinfo only on target_env=gnu (#32772)
mallinfo isn't available on musl, causing linking issues on build; make sure related functions are built only for GNU Libc Signed-off-by: Patrycja Rosa <git@ptrcnull.me>
This commit is contained in:
parent
cd394af018
commit
3118542a9e
1 changed files with 5 additions and 5 deletions
|
@ -394,7 +394,7 @@ mod system_reporter {
|
|||
#[cfg(not(any(target_os = "windows", target_env = "ohos")))]
|
||||
use std::ptr::null_mut;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
||||
use libc::c_int;
|
||||
#[cfg(not(any(target_os = "windows", target_env = "ohos")))]
|
||||
use libc::{c_void, size_t};
|
||||
|
@ -455,12 +455,12 @@ mod system_reporter {
|
|||
request.reports_channel.send(reports);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
||||
extern "C" {
|
||||
fn mallinfo() -> struct_mallinfo;
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
||||
#[repr(C)]
|
||||
pub struct struct_mallinfo {
|
||||
arena: c_int,
|
||||
|
@ -475,7 +475,7 @@ mod system_reporter {
|
|||
keepcost: c_int,
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
||||
fn system_heap_allocated() -> Option<usize> {
|
||||
let info: struct_mallinfo = unsafe { mallinfo() };
|
||||
|
||||
|
@ -494,7 +494,7 @@ mod system_reporter {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
|
||||
fn system_heap_allocated() -> Option<usize> {
|
||||
None
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue