[commit: packages/unix] master: Avoid redundant prototypes for ptsname(3) et al (2ddf4b2)
git at git.haskell.org
git at git.haskell.org
Tue Apr 19 21:37:59 UTC 2016
Repository : ssh://git@git.haskell.org/unix
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/2ddf4b2b7bf41f878bc7d8a1afa49126710f524c/unix
>---------------------------------------------------------------
commit 2ddf4b2b7bf41f878bc7d8a1afa49126710f524c
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Sun Jan 31 00:01:18 2016 +0100
Avoid redundant prototypes for ptsname(3) et al
This is now possible since we now use `AC_USE_SYSTEM_EXTENSIONS`, which
indirectly enables _XOPEN_SOURCE
>---------------------------------------------------------------
2ddf4b2b7bf41f878bc7d8a1afa49126710f524c
cbits/HsUnix.c | 9 +++------
include/HsUnix.h | 4 ----
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c
index e54bccf..09cfc9c 100644
--- a/cbits/HsUnix.c
+++ b/cbits/HsUnix.c
@@ -35,25 +35,22 @@ int __hsunix_getpwuid_r(uid_t uid, struct passwd *pw, char *buffer,
#endif
#ifdef HAVE_PTSNAME
-// I cannot figure out how to make the definitions of the following
-// functions visible in <stdlib.h> on Linux. But these definitions
-// follow the POSIX specs, and everything links and runs.
+// On Linux (and others), <stdlib.h> 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)
{
- extern char *ptsname(int);
return ptsname(fd);
}
int __hsunix_grantpt(int fd)
{
- extern int grantpt(int);
return grantpt(fd);
}
int __hsunix_unlockpt(int fd)
{
- extern int unlockpt(int);
return unlockpt(fd);
}
#endif
diff --git a/include/HsUnix.h b/include/HsUnix.h
index 7b404fc..98990b2 100644
--- a/include/HsUnix.h
+++ b/include/HsUnix.h
@@ -126,10 +126,6 @@ int __hsunix_getpwuid_r(uid_t, struct passwd *, char *, size_t,
#endif
#ifdef HAVE_PTSNAME
-// I cannot figure out how to make the definitions of the following
-// functions visible in <stdlib.h> on Linux. But these definitions
-// follow the POSIX specs, and everything links and runs.
-
char *__hsunix_ptsname(int fd);
int __hsunix_grantpt(int fd);
int __hsunix_unlockpt(int fd);
More information about the ghc-commits
mailing list