From 00557e661aa4cecba322802e696203f64508e04b Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Tue, 25 Sep 2007 11:33:30 +0000 Subject: Add basic pseudoterminal support. --- include/HsUnix.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'include') diff --git a/include/HsUnix.h b/include/HsUnix.h index 9b2e697..2df3932 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -74,6 +74,16 @@ #include #endif +#ifdef HAVE_LIBUTIL_H +#include +#endif +#ifdef HAVE_PTY_H +#include +#endif +#ifdef HAVE_UTMP_H +#include +#endif + #include #ifdef HAVE_SIGNAL_H @@ -130,4 +140,38 @@ INLINE int __hsunix_mknod(const char *pathname, mode_t mode, dev_t dev) return mknod(pathname,mode,dev); } +#ifdef HAVE_PTSNAME +// I cannot figure out how to make the definitions of the following +// functions visible in on Linux. But these definitions +// follow the POSIX specs, and everything links and runs. + +INLINE char *__hsunix_ptsname(int fd) +{ + extern char *ptsname(int); + return ptsname(fd); +} + +INLINE int __hsunix_grantpt(int fd) +{ + extern int grantpt(int); + return grantpt(fd); +} + +INLINE int __hsunix_unlockpt(int fd) +{ + extern int unlockpt(int); + return unlockpt(fd); +} +#endif + +// push a SVR4 STREAMS module; do nothing if STREAMS not available +INLINE int __hsunix_push_module(int fd, const char *module) +{ +#if defined(I_PUSH) && !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC) + return ioctl(fd, I_PUSH, module); +#else + return 0; +#endif +} + #endif -- cgit v1.2.3