summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViktor Dukhovni <ietf-dane@dukhovni.org>2021-02-28 00:39:36 -0500
committerBen Gamari <ben@smart-cactus.org>2021-06-03 13:28:21 -0400
commit1a700a4fbbc08703b04dc8edbcb16220dd839d97 (patch)
tree4e6b4a6147a9a154f46f850a1a8d0c89aae8d88d
parent8609bbd8bc6538452cac0b7ca03caebbd82c9e3a (diff)
downloadhaskell-1a700a4fbbc08703b04dc8edbcb16220dd839d97.tar.gz
Include mman.h before disabling non-POSIX headers
(cherry picked from commit 398994e19699f788a7810b4044e7aa817a10e73e)
-rw-r--r--rts/sm/Storage.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index b9ae97af4c..b28ada7f97 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -11,6 +11,18 @@
*
* ---------------------------------------------------------------------------*/
+#include <ghcconfig.h>
+#if RTS_LINKER_USE_MMAP
+/*
+ * On FreeBSD and Darwin, when _XOPEN_SOURCE is defined, MAP_ANONYMOUS is not
+ * exposed from <sys/mman.h>. Include <sys/mman.h> before "PosixSource.h".
+ *
+ * Alternatively, we could drop "PosixSource.h" from this file, but for just
+ * one non-POSIX macro, that seems a needless price to pay.
+ */
+#include <sys/mman.h>
+#endif
+
#include "PosixSource.h"
#include "Rts.h"