Cleanup PosixSource.h
authorMoritz Angermann <moritz.angermann@gmail.com>
Wed, 20 Jul 2016 07:53:45 +0000 (09:53 +0200)
committerBen Gamari <ben@smart-cactus.org>
Wed, 20 Jul 2016 13:17:50 +0000 (15:17 +0200)
commitcac3fb06f4b282eee21159c364c4d08e8fdedce9
tree49fb5138d4e9c33abf131e0200f8a917cc504237
parent8de6e13f9ef784750e502955fcb38d4a7e179727
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: rwbarton, erikd, austin, hvr, simonmar, bgamari

Reviewed By: simonmar, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2375
rts/PosixSource.h
rts/posix/OSThreads.c