diff options
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Modules/zpty.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c index 08ec1b2bd..360d1cc63 100644 --- a/Src/Modules/zpty.c +++ b/Src/Modules/zpty.c @@ -160,12 +160,31 @@ getptycmd(char *name) #include <sys/stropts.h> #endif +#if defined(I_FIND) && defined(I_PUSH) +/* + * These tests are ad hoc. Unfortunately if you get the wrong ioctl, + * STREAMS simply hangs up, so there's no obvious way of doing this + * more systematically. + * + * Apparently Solaris needs all three ioctls, but HP-UX doesn't need + * ttcompat. The Solaris definition has been extended to all __SVR4 + * as a guess; I have no idea if this is right. + */ +#ifdef __SVR4 +#define USE_STREAMS_IOCTLS +#define USE_STREAMS_TTCOMPAT +#endif +#ifdef __hpux +#define USE_STREAMS_IOCTLS +#endif +#endif + static int get_pty(int master, int *retfd) { static char *name; static int mfd, sfd; -#if defined(I_FIND) && defined(I_PUSH) && defined(__SVR4) +#ifdef USE_STREAMS_IOCTLS int ret; #endif @@ -190,11 +209,7 @@ get_pty(int master, int *retfd) close(mfd); return 1; } -#if defined(I_FIND) && defined(I_PUSH) && defined(__SVR4) - /* - * Use if STREAMS is available. The test is probably OK, - * but we could use e.g. the sys/stropts.h test. - */ +#ifdef USE_STREAMS_IOCTLS if ((ret = ioctl(sfd, I_FIND, "ptem")) != 1) if (ret == -1 || ioctl(sfd, I_PUSH, "ptem") == -1) { close(mfd); @@ -207,6 +222,7 @@ get_pty(int master, int *retfd) close(sfd); return 1; } +#ifdef USE_STREAMS_TTCOMPAT if ((ret = ioctl(sfd, I_FIND, "ttcompat")) != 1) if (ret == -1 || ioctl(sfd, I_PUSH, "ttcompat") == -1) { close(mfd); @@ -214,6 +230,7 @@ get_pty(int master, int *retfd) return 1; } #endif +#endif *retfd = sfd; |