libffi/0199-Define-_GNU_SOURCE-on-Linux-for-mremap.patch
2019-09-30 10:56:03 -04:00

39 lines
1016 B
Diff

From 1e82e1cda43dacd8b6ab2d9ac4db33523d86f5dc Mon Sep 17 00:00:00 2001
From: Berker Peksag <berker.peksag@gmail.com>
Date: Mon, 7 Mar 2016 18:38:10 +0200
Subject: [PATCH 199/411] Define _GNU_SOURCE on Linux for mremap()
This was committed to CPython's libffi copy in
https://bugs.python.org/issue10309
mremap() documentation says _GNU_SOURCE needs to
be defined in order to use mremap(): see the
synopsis section at http://linux.die.net/man/2/mremap
Original commit: https://hg.python.org/cpython/rev/9986fff720a2
Original patch was written by Hallvard B Furuseth.
---
src/dlmalloc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/dlmalloc.c b/src/dlmalloc.c
index 7e4ea83..d63dd36 100644
--- a/src/dlmalloc.c
+++ b/src/dlmalloc.c
@@ -438,6 +438,11 @@ DEFAULT_MMAP_THRESHOLD default: 256K
*/
+#if defined __linux__ && !defined _GNU_SOURCE
+/* mremap() on Linux requires this via sys/mman.h */
+#define _GNU_SOURCE 1
+#endif
+
#ifndef WIN32
#ifdef _WIN32
#define WIN32 1
--
1.8.3.1