aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Bryan O'Sullivan <bos@serpentine.com>2007-09-25 11:33:30 +0000
committerGravatar Bryan O'Sullivan <bos@serpentine.com>2007-09-25 11:33:30 +0000
commit00557e661aa4cecba322802e696203f64508e04b (patch)
treee14121daba6d503f9620d8da3d3a10a547efb652 /include
parent6ac0543f162e2935899ddf3d749893d8ceeed113 (diff)
Add basic pseudoterminal support.
Diffstat (limited to 'include')
-rw-r--r--include/HsUnix.h44
1 files changed, 44 insertions, 0 deletions
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 <dirent.h>
#endif
+#ifdef HAVE_LIBUTIL_H
+#include <libutil.h>
+#endif
+#ifdef HAVE_PTY_H
+#include <pty.h>
+#endif
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+
#include <dlfcn.h>
#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 <stdlib.h> 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