diff --git a/libc-test/src/functional/test-mallopt.c b/libc-test/src/functional/test-mallopt.c index 4a9e5c4289ec27f6bc2da6527a2e4a7047749640..35d6e08e5b6e126ed78003aaf288a1bff0658fa1 100644 --- a/libc-test/src/functional/test-mallopt.c +++ b/libc-test/src/functional/test-mallopt.c @@ -18,7 +18,7 @@ static int test_mallopt() { - return mallopt(0, 0) != 0; + return mallopt(0, 0) == 0; } int main() diff --git a/ndk_musl_include/malloc.h b/ndk_musl_include/malloc.h index 09c9f22506be0f0ec07281fbdea02a20ef795523..003d9197172b50454d91d1381b1e90cddbecd0d3 100644 --- a/ndk_musl_include/malloc.h +++ b/ndk_musl_include/malloc.h @@ -9,6 +9,16 @@ extern "C" { #include +#define M_SET_THREAD_CACHE -1001 +#define M_THREAD_CACHE_ENABLE 1 +#define M_THREAD_CACHE_DISABLE 0 + +#define M_FLUSH_THREAD_CACHE -1002 + +#define M_DELAYED_FREE -1003 +#define M_DELAYED_FREE_ENABLE 1 +#define M_DELAYED_FREE_DISABLE 0 + void *malloc (size_t); void *calloc (size_t, size_t); void *realloc (void *, size_t); @@ -17,6 +27,7 @@ void *valloc (size_t); void *memalign(size_t, size_t); size_t malloc_usable_size(void *); +int mallopt(int param, int value); struct mallinfo { int arena; diff --git a/ndk_script/adapter/libc.ndk.json b/ndk_script/adapter/libc.ndk.json index 5fa6bc830217eb5f67e2d1688fdd709dc94fd79e..d65516125ee833194597d87af2c5f2128f533687 100644 --- a/ndk_script/adapter/libc.ndk.json +++ b/ndk_script/adapter/libc.ndk.json @@ -736,6 +736,7 @@ { "name": "lutimes" }, { "name": "madvise" }, { "name": "malloc" }, + { "name": "mallopt" }, { "name": "malloc_usable_size" }, { "name": "mblen" }, { "name": "mbrlen" },