Skip to content

Add mallopt and related constants for Android #4459

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

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
17 changes: 17 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,22 @@ MS_STRICTATIME
MS_SYNC
MS_SYNCHRONOUS
MS_UNBINDABLE
M_BIONIC_SET_HEAP_TAGGING_LEVEL
M_BIONIC_ZERO_INIT
M_CACHE_COUNT_MAX
M_CACHE_SIZE_MAX
M_DECAY_TIME
M_HEAP_TAGGING_LEVEL_ASYNC
M_HEAP_TAGGING_LEVEL_NONE
M_HEAP_TAGGING_LEVEL_SYNC
M_HEAP_TAGGING_LEVEL_TBI
M_MEMTAG_TUNING
M_MEMTAG_TUNING_BUFFER_OVERFLOW
M_MEMTAG_TUNING_UAF
M_PURGE
M_PURGE_ALL
M_THREAD_DISABLE_MEM_INIT
M_TSDS_COUNT_MAX
NCCS
NCP_SUPER_MAGIC
NDA_CACHEINFO
Expand Down Expand Up @@ -3520,6 +3536,7 @@ makedev
mallinfo
malloc
malloc_usable_size
mallopt
mcontext_t
memalign
memchr
Expand Down
23 changes: 23 additions & 0 deletions src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3153,6 +3153,26 @@ pub const IFLA_INFO_XSTATS: c_ushort = 3;
pub const IFLA_INFO_SLAVE_KIND: c_ushort = 4;
pub const IFLA_INFO_SLAVE_DATA: c_ushort = 5;

// malloc.h
pub const M_DECAY_TIME: c_int = -100;
pub const M_PURGE: c_int = -101;
pub const M_MEMTAG_TUNING: c_int = -102;
pub const M_THREAD_DISABLE_MEM_INIT: c_int = -103;
pub const M_PURGE_ALL: c_int = -104;
pub const M_CACHE_COUNT_MAX: c_int = -200;
pub const M_CACHE_SIZE_MAX: c_int = -201;
pub const M_TSDS_COUNT_MAX: c_int = -202;
pub const M_BIONIC_ZERO_INIT: c_int = -203;
pub const M_BIONIC_SET_HEAP_TAGGING_LEVEL: c_int = -204;

pub const M_MEMTAG_TUNING_BUFFER_OVERFLOW: c_int = 0;
pub const M_MEMTAG_TUNING_UAF: c_int = 1;

pub const M_HEAP_TAGGING_LEVEL_NONE: i32 = 0;
pub const M_HEAP_TAGGING_LEVEL_TBI: i32 = 1;
pub const M_HEAP_TAGGING_LEVEL_ASYNC: i32 = 2;
pub const M_HEAP_TAGGING_LEVEL_SYNC: i32 = 3;

// linux/rtnetlink.h
pub const TCA_UNSPEC: c_ushort = 0;
pub const TCA_KIND: c_ushort = 1;
Expand Down Expand Up @@ -3650,6 +3670,9 @@ extern "C" {

pub fn malloc_usable_size(ptr: *const c_void) -> size_t;

// available from API level 26
pub fn mallopt(opt: c_int, arg: c_int) -> c_int;

pub fn utmpname(name: *const c_char) -> c_int;
pub fn setutent();
pub fn getutent() -> *mut utmp;
Expand Down
Loading