summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2018-07-19 05:08:59 +0000
committerDavid Carlier <devnexen@gmail.com>2018-07-19 05:08:59 +0000
commit2722b7ab7ca642c664fbbbf526c60318cc58e096 (patch)
treef9c898e211af1ead6e626a7124f60bc9ac4221c0 /lib
parent456e46e79e9905cef504154aa83505b76d9e32cd (diff)
[Xray] Fix allocator build, MAP_NORESERVE flag is not always supported
MAP_NORESERVE is not supported or a no-op on BSD. Reviewers: dberris Reviewed By: dberris Differential Revision: https://reviews.llvm.org/D49494 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337440 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/xray/xray_allocator.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/xray/xray_allocator.h b/lib/xray/xray_allocator.h
index 5d0a62547..824481528 100644
--- a/lib/xray/xray_allocator.h
+++ b/lib/xray/xray_allocator.h
@@ -20,11 +20,16 @@
#include "sanitizer_common/sanitizer_internal_defs.h"
#include "sanitizer_common/sanitizer_mutex.h"
#include "sanitizer_common/sanitizer_posix.h"
-#include "sys/mman.h"
#include "xray_utils.h"
+#include <sys/mman.h>
#include <cstddef>
#include <cstdint>
+#ifndef MAP_NORESERVE
+// no-op on NetBSD (at least), unsupported flag on FreeBSD basically because unneeded
+#define MAP_NORESERVE 0
+#endif
+
namespace __xray {
/// The Allocator type hands out fixed-sized chunks of memory that are