zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: Zsh workers <zsh-workers@sunsite.dk>
Subject: PATCH: zpty on HP/UX
Date: Tue, 16 Mar 2004 15:07:30 +0000	[thread overview]
Message-ID: <28264.1079449650@csr.com> (raw)
In-Reply-To: "Peter Stephenson"'s message of "Mon, 15 Mar 2004 17:11:31 GMT." <5306.1079370691@csr.com>

> Unless someone turns out to be a secret STREAMS expert we are stuck with
> doing it machine by machine, i.e. adding __hpux where necessary.
> I don't see a good reason for changing from __SVR4 for the other case.

Here's a patch which doesn't screw up Solaris, at least.

Index: Src/Modules/zpty.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zpty.c,v
retrieving revision 1.30
diff -u -r1.30 zpty.c
--- Src/Modules/zpty.c	26 Feb 2004 20:48:09 -0000	1.30
+++ Src/Modules/zpty.c	16 Mar 2004 14:47:05 -0000
@@ -160,12 +160,31 @@
 #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 @@
 	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 @@
 	   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 @@
 	   return 1;
        }
 #endif
+#endif
 
     *retfd = sfd;
 

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


  reply	other threads:[~2004-03-16 15:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-15 16:55 Oliver Kiddle
2004-03-15 17:11 ` Peter Stephenson
2004-03-16 15:07   ` Peter Stephenson [this message]
2004-03-16 19:47     ` PATCH: " Oliver Kiddle
2004-03-16 23:50       ` mneptok
2004-03-17 10:12         ` Oliver Kiddle
2004-03-17 10:23           ` PATCH: zpty on HP/UX (and Mac OS X 10.3) James Devenish
2004-03-17 11:10             ` mneptok
2004-03-17 11:34               ` Mac OS X 10.3 again [was: PATCH: zpty on HP/UX] James Devenish
2004-03-17 13:19                 ` Mac OS X 10.3 again James Devenish
2004-03-17 11:19             ` PATCH: zpty on HP/UX (and Mac OS X 10.3) Oliver Kiddle
2004-03-17 13:02               ` zpty on Mac OS X 10.2 Peter Stephenson
2004-03-17 14:00                 ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28264.1079449650@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).