texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6320] STREAMS ioctls for pseudotty


From: Gavin D. Smith
Subject: [6320] STREAMS ioctls for pseudotty
Date: Sun, 07 Jun 2015 17:18:56 +0000

Revision: 6320
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6320
Author:   gavin
Date:     2015-06-07 17:18:36 +0000 (Sun, 07 Jun 2015)
Log Message:
-----------
STREAMS ioctls for pseudotty

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/configure.ac
    trunk/info/pseudotty.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-06-07 15:25:25 UTC (rev 6319)
+++ trunk/ChangeLog     2015-06-07 17:18:36 UTC (rev 6320)
@@ -1,5 +1,13 @@
 2015-06-07  Gavin Smith  <address@hidden>
 
+       * configure.ac (AC_CHECK_HEADERS): Check for stropts.h.
+       * info/pseudotty.c [HAVE_STROPTS_H]: Perform STREAMS ioctl's on 
+       slave device, as recommended in the GNU C Library Reference 
+       Manual.  (Attempt at stopping hang of test replace-viewed.sh 
+       under Solaris 10.)
+
+2015-06-07  Gavin Smith  <address@hidden>
+
        * info/t/c-u-m-x-scroll-forward: Synch with controlled program 
        before sending in typed input.  (Attempt at fixing test failures 
        under CentOS.)

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac  2015-06-07 15:25:25 UTC (rev 6319)
+++ trunk/configure.ac  2015-06-07 17:18:36 UTC (rev 6320)
@@ -138,7 +138,7 @@
 AC_HEADER_STAT
 AC_HEADER_STDC
 AC_CHECK_HEADERS(fcntl.h io.h limits.h pwd.h string.h strings.h \
-  termcap.h termio.h termios.h unistd.h \
+  stropts.h termcap.h termio.h termios.h unistd.h \
   sys/fcntl.h sys/file.h sys/ioctl.h sys/stream.h \
   sys/time.h sys/ttold.h sys/wait.h)
 

Modified: trunk/info/pseudotty.c
===================================================================
--- trunk/info/pseudotty.c      2015-06-07 15:25:25 UTC (rev 6319)
+++ trunk/info/pseudotty.c      2015-06-07 17:18:36 UTC (rev 6320)
@@ -33,13 +33,17 @@
 #include <stdlib.h>
 #include <string.h>
 
+#if HAVE_STROPTS_H
+#include <stropts.h>
+#endif
+
 /* Used by "error" function. */
 const char *program_name = "pseudotty";
 
 int
 main (int argc, char *argv[])
 {
-  int master, control;
+  int master, slave, control;
   char *name;
   fd_set read_set;
 
@@ -55,9 +59,31 @@
   name = ptsname (master);
   if (!name)
     exit (1);
-
   error (0, 0, "%s", name);
 
+#ifdef HAVE_STROPTS_H
+  error (0, 0, "opening slave device");
+  slave = open (name, O_RDWR);
+  if (slave == -1)
+    exit (1);
+  if (!isatty (slave))
+    {
+      error (0, 0, "performing STREAMS ioctl's on slave");
+      if (isastream (slave))
+        {
+          if (ioctl (slave, I_PUSH, "ptem") < 0
+              || ioctl (slave, I_PUSH, "ldterm") < 0)
+            error (1, 0, "STREAMS ioctl's failed");
+        }
+    }
+  /* Don't close it because it just leads to an EOF read at the master end. */
+  /*
+  error (0, 0, "closing slave device");
+  close (slave);
+  error (0, 0, "...closed");
+  */
+#endif
+
   printf ("%s\n", name);
   if (fclose (stdout) != 0)
     error (1, 0, "error closing stdout: aborting");




reply via email to

[Prev in Thread] Current Thread [Next in Thread]