mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-24 06:16:30 +03:00
allocator: Fix __THROW and mallinfo for Musl
This commit is contained in:
parent
0151580c19
commit
eb7afd95ee
@ -284,7 +284,12 @@ void PartitionAllocMallocInitOnce() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
#if defined(__MUSL__)
|
||||||
|
// Musl calls malloc() in pthread_atfork(), resulting in a deadlock.
|
||||||
|
static_cast<void>(BeforeForkInParent);
|
||||||
|
static_cast<void>(AfterForkInParent);
|
||||||
|
static_cast<void>(AfterForkInChild);
|
||||||
|
#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||||
// When fork() is called, only the current thread continues to execute in the
|
// When fork() is called, only the current thread continues to execute in the
|
||||||
// child process. If the lock is held, but *not* by this thread when fork() is
|
// child process. If the lock is held, but *not* by this thread when fork() is
|
||||||
// called, we have a deadlock.
|
// called, we have a deadlock.
|
||||||
|
@ -760,7 +760,7 @@ SHIM_ALWAYS_EXPORT int mallopt(int cmd, int value) __THROW {
|
|||||||
|
|
||||||
#endif // !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID)
|
#endif // !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID)
|
||||||
|
|
||||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
#if BUILDFLAG(IS_LINUX) && !defined(__MUSL__) || BUILDFLAG(IS_CHROMEOS)
|
||||||
SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
|
SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
|
||||||
partition_alloc::SimplePartitionStatsDumper allocator_dumper;
|
partition_alloc::SimplePartitionStatsDumper allocator_dumper;
|
||||||
Allocator()->DumpStats("malloc", true, &allocator_dumper);
|
Allocator()->DumpStats("malloc", true, &allocator_dumper);
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
|
|
||||||
#if BUILDFLAG(IS_POSIX)
|
// Musl does not provide sys/cdefs.h
|
||||||
|
#if BUILDFLAG(IS_POSIX) && !defined(__MUSL__)
|
||||||
#include <sys/cdefs.h> // for __THROW
|
#include <sys/cdefs.h> // for __THROW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -22,6 +22,12 @@
|
|||||||
|
|
||||||
#include "base/allocator/partition_allocator/shim/allocator_shim_internals.h"
|
#include "base/allocator/partition_allocator/shim/allocator_shim_internals.h"
|
||||||
|
|
||||||
|
// Musl does not specify anything for malloc() etc.
|
||||||
|
#if defined(__MUSL__)
|
||||||
|
#undef __THROW
|
||||||
|
#define __THROW
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
// WARNING: Whenever a new function is added there (which, surprisingly enough,
|
// WARNING: Whenever a new function is added there (which, surprisingly enough,
|
||||||
|
Loading…
Reference in New Issue
Block a user