Skip to content

Commit 6ed451c

Browse files
committed
fix linux compile by including linux/prctl.h
1 parent 01ee356 commit 6ed451c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/prim/unix/prim.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ terms of the MIT license. A copy of the license can be found in the file
3131

3232
#if defined(__linux__)
3333
#include <features.h>
34+
#include <linux/prctl.h> // PR_SET_VMA
3435
//#if defined(MI_NO_THP)
35-
#include <sys/prctl.h> // THP disable
36+
#include <sys/prctl.h> // THP disable
3637
//#endif
3738
#if defined(__GLIBC__)
38-
#include <linux/mman.h> // linux mmap flags
39+
#include <linux/mman.h> // linux mmap flags
3940
#else
4041
#include <sys/mman.h>
4142
#endif
@@ -207,7 +208,7 @@ static int unix_madvise(void* addr, size_t size, int advice) {
207208

208209
static void* unix_mmap_prim(void* addr, size_t size, int protect_flags, int flags, int fd) {
209210
void* p = mmap(addr, size, protect_flags, flags, fd, 0 /* offset */);
210-
#if (defined(__linux__) || defined(__ANDROID__))
211+
#if (defined(__linux__) && defined(PR_SET_VMA))
211212
if (p!=MAP_FAILED && p!=NULL) {
212213
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, size, "mimalloc");
213214
}

0 commit comments

Comments
 (0)