aboutsummaryrefslogtreecommitdiffstats
path: root/components/profile
diff options
context:
space:
mode:
authorPatrycja <github@ptrcnull.me>2024-07-14 09:20:52 +0200
committerGitHub <noreply@github.com>2024-07-14 07:20:52 +0000
commit3118542a9e90478cdabf1f2479851f86dd0e94d6 (patch)
treeac09050c91fbe7972eb60c4a48eaaf13d2f5c62f /components/profile
parentcd394af018c1816f5d504e49b37af9258ce052e6 (diff)
downloadservo-3118542a9e90478cdabf1f2479851f86dd0e94d6.tar.gz
servo-3118542a9e90478cdabf1f2479851f86dd0e94d6.zip
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>
Diffstat (limited to 'components/profile')
-rw-r--r--components/profile/mem.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/components/profile/mem.rs b/components/profile/mem.rs
index 565cae95c53..bd42e5fa93c 100644
--- a/components/profile/mem.rs
+++ b/components/profile/mem.rs
@@ -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
}