summaryrefslogtreecommitdiff
path: root/rts/posix/OSThreads.c
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2016-10-09 18:19:26 -0400
committerBen Gamari <ben@smart-cactus.org>2016-10-09 18:19:32 -0400
commit8dc72f3c33b0e724ddb690c9d494969980c10afd (patch)
treee3f886800e6eec8fd68a9470373b6743db673966 /rts/posix/OSThreads.c
parentbcd34451382e0d1b52ef82cb9d762e9d68bc0887 (diff)
downloadhaskell-8dc72f3c33b0e724ddb690c9d494969980c10afd.tar.gz
Cleanup PosixSource.h
When trying to build arm64-apple-iso, the build fell over `strdup`, as the arm64-apple-ios build did not fall into `darwin_HOST_OS`, and would need `ios_HOST_OS`. This diff tries to clean up PosixSource.h, instead of layering another define on top. As we use `strnlen` in sources that include PosixSource.h, and `strnlen` is defined in POSIX.1-2008, the `_POSIX_C_SOURCE` and `_XOPEN_SOURCE` are increased accordingly. Furthermore the `_DARWIN_C_SOURCE` (required for `u_char`, etc. used in sysctl.h) define is moved into `OSThreads.h` alongside a similar ifdef for freebsd. Test Plan: Build on all supported platforms. Reviewers: austin, simonmar, erikd, kgardas, bgamari Reviewed By: simonmar, erikd, kgardas, bgamari Subscribers: Phyx, hvr, thomie Differential Revision: https://phabricator.haskell.org/D2579 GHC Trac Issues: #12624
Diffstat (limited to 'rts/posix/OSThreads.c')
-rw-r--r--rts/posix/OSThreads.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c
index 8c7c8f0e24..63e979080c 100644
--- a/rts/posix/OSThreads.c
+++ b/rts/posix/OSThreads.c
@@ -14,6 +14,11 @@
* because of some specific types, like u_char, u_int, etc. */
#define __BSD_VISIBLE 1
#endif
+#if defined(darwin_HOST_OS)
+/* Inclusion of system headers usually requires _DARWIN_C_SOURCE on Mac OS X
+ * because of some specific types like u_char, u_int, etc. */
+#define _DARWIN_C_SOURCE 1
+#endif
#include "Rts.h"