mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-03 22:19:32 +03:00
fix linux compile by including linux/prctl.h
This commit is contained in:
parent
01ee3568c1
commit
6ed451c555
1 changed files with 4 additions and 3 deletions
|
@ -31,11 +31,12 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
#include <features.h>
|
#include <features.h>
|
||||||
|
#include <linux/prctl.h> // PR_SET_VMA
|
||||||
//#if defined(MI_NO_THP)
|
//#if defined(MI_NO_THP)
|
||||||
#include <sys/prctl.h> // THP disable
|
#include <sys/prctl.h> // THP disable
|
||||||
//#endif
|
//#endif
|
||||||
#if defined(__GLIBC__)
|
#if defined(__GLIBC__)
|
||||||
#include <linux/mman.h> // linux mmap flags
|
#include <linux/mman.h> // linux mmap flags
|
||||||
#else
|
#else
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -207,7 +208,7 @@ static int unix_madvise(void* addr, size_t size, int advice) {
|
||||||
|
|
||||||
static void* unix_mmap_prim(void* addr, size_t size, int protect_flags, int flags, int fd) {
|
static void* unix_mmap_prim(void* addr, size_t size, int protect_flags, int flags, int fd) {
|
||||||
void* p = mmap(addr, size, protect_flags, flags, fd, 0 /* offset */);
|
void* p = mmap(addr, size, protect_flags, flags, fd, 0 /* offset */);
|
||||||
#if (defined(__linux__) || defined(__ANDROID__))
|
#if (defined(__linux__) && defined(PR_SET_VMA))
|
||||||
if (p!=MAP_FAILED && p!=NULL) {
|
if (p!=MAP_FAILED && p!=NULL) {
|
||||||
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, size, "mimalloc");
|
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, size, "mimalloc");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue