Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android: add mallinfo2 #3940

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3454,6 +3454,7 @@ madvise
major
makedev
mallinfo
mallinfo2
malloc
malloc_usable_size
mcontext_t
Expand Down
16 changes: 16 additions & 0 deletions src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ s! {
pub keepcost: ::size_t,
}

// This is identical to struct mallinfo on Android
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 flock {
pub l_type: ::c_short,
pub l_whence: ::c_short,
Expand Down Expand Up @@ -3744,6 +3758,8 @@ extern "C" {
pub fn __sched_cpucount(setsize: ::size_t, set: *const cpu_set_t) -> ::c_int;
pub fn sched_getcpu() -> ::c_int;
pub fn mallinfo() -> ::mallinfo;
#[link_name = "mallinfo"]
pub fn mallinfo2() -> ::mallinfo2;
// available from API 23
pub fn malloc_info(options: ::c_int, stream: *mut ::FILE) -> ::c_int;

Expand Down