From fbcf62b077f24a5426ddab232dd3cb3a1923a0e4 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 10 Jun 2021 14:43:50 +0200 Subject: [PATCH 1/2] Add `mallinfo2` support --- src/unix/linux_like/linux/gnu/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index cc7e414f69c29..ad0f88261dfcb 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -128,6 +128,19 @@ s! { pub keepcost: ::c_int, } + pub struct mallinfo2 { + pub arena: ::size_t, + pub ordblks: ::size_t, + pub smblks: ::size_t, + pub hblks: ::size_t, + pub hblkhd: ::size_t, + pub usmblks: ::size_t, + pub fsmblks: ::size_t, + pub uordblks: ::size_t, + pub fordblks: ::size_t, + pub keepcost: ::size_t, + } + pub struct nlmsghdr { pub nlmsg_len: u32, pub nlmsg_type: u16, @@ -1281,6 +1294,7 @@ extern "C" { ) -> ::c_int; pub fn sched_getcpu() -> ::c_int; pub fn mallinfo() -> ::mallinfo; + pub fn mallinfo2() -> ::mallinfo2; pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t; pub fn getpwent_r( pwd: *mut ::passwd, From 7f6ce32a3120974190d2ff03d84380549f767ced Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 10 Jun 2021 15:07:29 +0200 Subject: [PATCH 2/2] Try to appease CI --- libc-test/build.rs | 6 ++++++ libc-test/semver/linux-gnu.txt | 1 + 2 files changed, 7 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 276be492591fd..0f2eefaf1c696 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2650,6 +2650,9 @@ fn test_linux(target: &str) { // FIXME: CI's kernel header version is old. "sockaddr_can" => true, + // Requires glibc 2.33 or newer. + "mallinfo2" => true, + _ => false, } }); @@ -2853,6 +2856,9 @@ fn test_linux(target: &str) { // FIXME: This needs musl 1.2.2 or later. "gettid" if musl => true, + // Needs glibc 2.33 or later. + "mallinfo2" => true, + _ => false, } }); diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 58b2eb6c944b1..fb3256086cb6c 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -546,6 +546,7 @@ glob_t globfree globfree64 mallinfo +mallinfo2 malloc_usable_size mallopt nl_mmap_hdr