From fb9b3eb74be56579deaa6e653686405e2e0463dd Mon Sep 17 00:00:00 2001 From: Herbert Valerio Riedel Date: Sun, 31 Jan 2016 12:34:59 +0100 Subject: Use CApiFFI for `ptsname(3)` et al for GHC>=8.0 This improves on 2ddf4b2b7bf41f878bc7d8a1afa49126710f524c --- cbits/HsUnix.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'cbits/HsUnix.c') diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 25fd8ad..5742b49 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -16,25 +16,14 @@ void *__hsunix_rtldNext (void) {return RTLD_NEXT;} void *__hsunix_rtldDefault (void) {return RTLD_DEFAULT;} #endif -#ifdef HAVE_PTSNAME +#if HAVE_PTSNAME && (__GLASGOW_HASKELL__ < 800) // On Linux (and others), needs to be included while // `_XOPEN_SOURCE` is already defined. However, GHCs before GHC 8.0 // didn't do that yet for CApiFFI, so we need this workaround here. -char *__hsunix_ptsname(int fd) -{ - return ptsname(fd); -} - -int __hsunix_grantpt(int fd) -{ - return grantpt(fd); -} - -int __hsunix_unlockpt(int fd) -{ - return unlockpt(fd); -} +char *__hsunix_ptsname(int fd) { return ptsname(fd); } +int __hsunix_grantpt(int fd) { return grantpt(fd); } +int __hsunix_unlockpt(int fd) { return unlockpt(fd); } #endif // push a SVR4 STREAMS module; do nothing if STREAMS not available @@ -71,7 +60,6 @@ HsInt __hsunix_long_path_size(void) { #endif } - /* * read an entry from the directory stream; opt for the * re-entrant friendly way of doing this, if available. -- cgit v1.2.3