emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109048: Move PTY_NAME_SPRINTF, PTY_T


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109048: Move PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF from src/s to configure
Date: Thu, 12 Jul 2012 00:43:05 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109048
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Thu 2012-07-12 00:43:05 -0700
message:
  Move PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF from src/s to configure
  
  * configure.ac (PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF): Move here from src/s.
  
  * src/s/aix4-2.h, src/s/cygwin.h, src/s/darwin.h:
  * src/s/gnu-linux.h, src/s/hpux10-20.h, src/s/irix6-5.h:
  * src/s/sol2-6.h, src/s/unixware.h, src/s/usg5-4-common.h:
  Move PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF to configure.
modified:
  ChangeLog
  configure.ac
  src/ChangeLog
  src/s/aix4-2.h
  src/s/cygwin.h
  src/s/darwin.h
  src/s/gnu-linux.h
  src/s/hpux10-20.h
  src/s/irix6-5.h
  src/s/sol2-6.h
  src/s/unixware.h
  src/s/usg5-4-common.h
=== modified file 'ChangeLog'
--- a/ChangeLog 2012-07-12 07:10:44 +0000
+++ b/ChangeLog 2012-07-12 07:43:05 +0000
@@ -7,7 +7,8 @@
        (BROKEN_FIONREAD, BROKEN_PTY_READ_AFTER_EAGAIN, BROKEN_SIGAIO)
        (BROKEN_SIGPOLL, BROKEN_SIGPTY, FIRST_PTY_LETTER)
        (G_SLICE_ALWAYS_MALLOC, PREFER_VSUSP, PTY_ITERATION, PTY_OPEN)
-       (RUN_TIME_REMAP, SETPGRP_RELEASES_CTTY, TAB3, TABDLY, RUN_TIME_REMAP
+       (PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF, RUN_TIME_REMAP)
+       (SETPGRP_RELEASES_CTTY, TAB3, TABDLY, RUN_TIME_REMAP)
        (XOS_NEEDS_TIME_H): Move here from src/s.
 
 2012-07-11  Glenn Morris  <address@hidden>

=== modified file 'configure.ac'
--- a/configure.ac      2012-07-12 07:10:44 +0000
+++ b/configure.ac      2012-07-12 07:43:05 +0000
@@ -3299,16 +3299,26 @@
 AH_TEMPLATE(FIRST_PTY_LETTER, [Letter to use in finding device name of
   first PTY, if PTYs are supported.])
 AH_TEMPLATE(PTY_OPEN, [How to open a PTY, if non-standard.])
+AH_TEMPLATE(PTY_NAME_SPRINTF, [How to get the device name of the control
+  end of a PTY, if non-standard.])
+AH_TEMPLATE(PTY_TTY_NAME_SPRINTF, [How to get device name of the tty
+  end of a PTY, if non-standard.])
 
 case $opsys in
   aix4-2 )
     AC_DEFINE(PTY_ITERATION, [int c; for (c = 0; !c ; c++)] )
+    dnl You allocate a pty by opening /dev/ptc to get the master side.
+    dnl To get the name of the slave side, you just ttyname() the master side.
+    AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");] )
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [strcpy (pty_name, ttyname (fd));] )
     ;;
 
   cygwin )
     AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)] )
     dnl multi-line AC_DEFINEs are hard. :(
     AC_DEFINE(PTY_OPEN, [ do { int dummy; SIGMASKTYPE mask; mask = sigblock 
(sigmask (SIGCHLD)); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; 
sigsetmask (mask); if (fd >= 0) emacs_close (dummy); } while (0)] )
+    AC_DEFINE(PTY_NAME_SPRINTF, [] )
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [] )
     ;;
 
   darwin )
@@ -3319,9 +3329,11 @@
     dnl But we don't have to block SIGCHLD because it is blocked in the
     dnl implementation of grantpt.
     AC_DEFINE(PTY_OPEN, [ do { int slave; if (openpty (&fd, &slave, pty_name, 
NULL, NULL) == -1) fd = -1; else emacs_close (slave); } while (0)] )
+    AC_DEFINE(PTY_NAME_SPRINTF, [] )
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [] )
     ;;
 
-  gnu | hpux* | freebsd | netbsd | openbsd )
+  gnu | freebsd | netbsd | openbsd )
     AC_DEFINE(FIRST_PTY_LETTER, ['p'])
     ;;
 
@@ -3329,15 +3341,27 @@
     dnl if HAVE_GRANTPT
     if test "x$ac_cv_func_grantpt" = xyes; then
       AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)] )
+      dnl Note that grantpt and unlockpt may fork.  We must block SIGCHLD
+      dnl to prevent sigchld_handler from intercepting the child's death.
+      AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname; sigblock (sigmask 
(SIGCHLD)); if (grantpt (fd) == -1 || unlockpt (fd) == -1 || !(ptyname = 
ptsname(fd))) { sigunblock (sigmask (SIGCHLD)); close (fd); return -1; } 
snprintf (pty_name, sizeof pty_name, "%s", ptyname); sigunblock (sigmask 
(SIGCHLD)); }] )
       dnl if HAVE_GETPT
       if test "x$ac_cv_func_getpt" = xyes; then
         AC_DEFINE(PTY_OPEN, [fd = getpt ()])
+        AC_DEFINE(PTY_NAME_SPRINTF, [] )
+      else
+        AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");] )
       fi
     else
       AC_DEFINE(FIRST_PTY_LETTER, ['p'])
     fi
     ;;
 
+  hpux*)
+    AC_DEFINE(FIRST_PTY_LETTER, ['p'])
+    AC_DEFINE(PTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ptym/pty%c%x", c, 
i);] )
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/pty/tty%c%x", c, 
i);] )
+    ;;
+
   irix6-5 )
     dnl It looks like this cannot be right, because it is not a loop.
     dnl However, process.c actually does this:
@@ -3353,12 +3377,31 @@
     dnl Not used, because PTY_ITERATION is defined.
     AC_DEFINE(FIRST_PTY_LETTER, ['q'])
     AC_DEFINE(PTY_OPEN, [ { struct sigaction ocstat, cstat; struct stat stb; 
char * name; sigemptyset(&cstat.sa_mask); cstat.sa_handler = SIG_DFL; 
cstat.sa_flags = 0; sigaction(SIGCLD, &cstat, &ocstat); name = _getpty (&fd, 
O_RDWR | O_NDELAY, 0600, 0); sigaction(SIGCLD, &ocstat, (struct sigaction *)0); 
if (name == 0) return -1; if (fd < 0) return -1; if (fstat (fd, &stb) < 0) 
return -1; strcpy (pty_name, name); }] )
+    dnl No need to get the pty name at all. 
+    AC_DEFINE(PTY_NAME_SPRINTF, [] )
+    dnl No need to use sprintf to get the tty name--we get that from _getpty.
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [] )
     ;;
 
-  sol2* | unixware )
+  sol2* )
     dnl This change means that we don't loop through allocate_pty too
     dnl many times in the (rare) event of a failure.
     AC_DEFINE(FIRST_PTY_LETTER, ['z'])
+    AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");] )
+    dnl Uses sigblock/sigunblock rather than sighold/sigrelse,
+    dnl which appear to be BSD4.1 specific.  It may also be appropriate
+    dnl for SVR4.x (x<2) but I'm not sure.   address@hidden
+    dnl On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler()
+    dnl from intercepting that death.  If any child but grantpt's should die
+    dnl within, it should be caught after sigrelse(2).
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock 
(sigmask (SIGCLD)); if (grantpt (fd) == -1) { emacs_close (fd); return -1; } 
sigunblock (sigmask (SIGCLD)); if (unlockpt (fd) == -1) { emacs_close (fd); 
return -1; } if (!(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } 
snprintf (pty_name, sizeof pty_name, "%s", ptyname); }] )
+    ;;
+
+  dnl Comments are as per sol2*.
+  unixware )
+    AC_DEFINE(FIRST_PTY_LETTER, ['z'])
+    AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");] )
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; 
sigblock(sigmask(SIGCLD)); if (grantpt(fd) == -1) fatal("could not grant slave 
pty"); sigunblock(sigmask(SIGCLD)); if (unlockpt(fd) == -1) fatal("could not 
unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable 
slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }] )
     ;;
 esac
 

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-12 07:10:44 +0000
+++ b/src/ChangeLog     2012-07-12 07:43:05 +0000
@@ -1,5 +1,10 @@
 2012-07-12  Glenn Morris  <address@hidden>
 
+       * src/s/aix4-2.h, src/s/cygwin.h, src/s/darwin.h:
+       * src/s/gnu-linux.h, src/s/hpux10-20.h, src/s/irix6-5.h:
+       * src/s/sol2-6.h, src/s/unixware.h, src/s/usg5-4-common.h:
+       Move PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF to configure.
+
        * s/cygwin.h, s/darwin.h, s/gnu-linux.h, s/irix6-5.h:
        Move PTY_OPEN to configure.
 

=== modified file 'src/s/aix4-2.h'
--- a/src/s/aix4-2.h    2012-07-12 06:34:40 +0000
+++ b/src/s/aix4-2.h    2012-07-12 07:43:05 +0000
@@ -26,11 +26,6 @@
 #define _AIX
 #endif
 
-/* In AIX, you allocate a pty by opening /dev/ptc to get the master side.
-   To get the name of the slave side, you just ttyname() the master side.  */
-#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptc");
-#define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd));
-
 
 /* Special items needed to make Emacs run on this system.  */
 

=== modified file 'src/s/cygwin.h'
--- a/src/s/cygwin.h    2012-07-12 07:10:44 +0000
+++ b/src/s/cygwin.h    2012-07-12 07:43:05 +0000
@@ -17,8 +17,5 @@
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#define PTY_NAME_SPRINTF       /* none */
-#define PTY_TTY_NAME_SPRINTF   /* none */
-
 /* Used in various places to enable cygwin-specific code changes.  */
 #define CYGWIN 1

=== modified file 'src/s/darwin.h'
--- a/src/s/darwin.h    2012-07-12 07:10:44 +0000
+++ b/src/s/darwin.h    2012-07-12 07:43:05 +0000
@@ -30,9 +30,6 @@
    distinguish OS X from pure Darwin.  */
 #define DARWIN_OS
 
-#define PTY_NAME_SPRINTF       /* none */
-#define PTY_TTY_NAME_SPRINTF   /* none */
-
 /* PTYs only work correctly on Darwin 7 or higher.  So make the default
    for process-connection-type dependent on the kernel version.  */
 #define MIN_PTY_KERNEL_VERSION '7'

=== modified file 'src/s/gnu-linux.h'
--- a/src/s/gnu-linux.h 2012-07-12 07:10:44 +0000
+++ b/src/s/gnu-linux.h 2012-07-12 07:43:05 +0000
@@ -27,31 +27,6 @@
 
 #if defined HAVE_GRANTPT
 #define UNIX98_PTYS
-
-#ifdef HAVE_GETPT
-#define PTY_NAME_SPRINTF
-#else /* not HAVE_GETPT */
-#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
-#endif /* not HAVE_GETPT */
-
-/* Note that grantpt and unlockpt may fork.  We must block SIGCHLD to
-   prevent sigchld_handler from intercepting the child's death.  */
-#define PTY_TTY_NAME_SPRINTF                           \
-  {                                                    \
-    char *ptyname;                                     \
-                                                       \
-    sigblock (sigmask (SIGCHLD));                      \
-    if (grantpt (fd) == -1 || unlockpt (fd) == -1      \
-        || !(ptyname = ptsname(fd)))                   \
-      {                                                        \
-       sigunblock (sigmask (SIGCHLD));                 \
-       close (fd);                                     \
-       return -1;                                      \
-      }                                                        \
-    snprintf (pty_name, sizeof pty_name, "%s", ptyname); \
-    sigunblock (sigmask (SIGCHLD));                    \
-  }
-
 #endif  /* HAVE_GRANTPT */
 
 /* Here, on a separate page, add any special hacks needed

=== modified file 'src/s/hpux10-20.h'
--- a/src/s/hpux10-20.h 2012-07-12 06:34:40 +0000
+++ b/src/s/hpux10-20.h 2012-07-12 07:43:05 +0000
@@ -26,14 +26,6 @@
 
 /* Special hacks needed to make Emacs run on this system.  */
 
-/* This is how to get the device name of the tty end of a pty.  */
-#define PTY_TTY_NAME_SPRINTF \
-            sprintf (pty_name, "/dev/pty/tty%c%x", c, i);
-
-/* This is how to get the device name of the control end of a pty.  */
-#define PTY_NAME_SPRINTF \
-       sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);
-
 /* Assar Westerlund <address@hidden> says this is necessary for
    HP-UX 10.20, and that it works for HP-UX 0 as well.  */
 #define NO_EDITRES

=== modified file 'src/s/irix6-5.h'
--- a/src/s/irix6-5.h   2012-07-12 07:10:44 +0000
+++ b/src/s/irix6-5.h   2012-07-12 07:43:05 +0000
@@ -26,11 +26,6 @@
 
 #undef SETUP_SLAVE_PTY
 
-/* No need to use sprintf to get the tty name--we get that from _getpty.  */
-#define PTY_TTY_NAME_SPRINTF
-/* No need to get the pty name at all.  */
-#undef PTY_NAME_SPRINTF
-#define PTY_NAME_SPRINTF
 #ifdef emacs
 char *_getpty();
 #endif

=== modified file 'src/s/sol2-6.h'
--- a/src/s/sol2-6.h    2012-07-12 01:49:28 +0000
+++ b/src/s/sol2-6.h    2012-07-12 07:43:05 +0000
@@ -21,28 +21,4 @@
 
 #define SOLARIS2
 
-/* This is the same definition as in usg5-4-common.h, but with 
sigblock/sigunblock
-   rather than sighold/sigrelse, which appear to be BSD4.1 specific.
-   It may also be appropriate for SVR4.x
-   (x<2) but I'm not sure.   address@hidden */
-/* This sets the name of the slave side of the PTY.  On SysVr4,
-   grantpt(3) forks a subprocess, so keep sigchld_handler() from
-   intercepting that death.  If any child but grantpt's should die
-   within, it should be caught after sigrelse(2). */
-
-#define PTY_TTY_NAME_SPRINTF                   \
-  {                                            \
-    char *ptsname (int), *ptyname;             \
-                                               \
-    sigblock (sigmask (SIGCLD));               \
-    if (grantpt (fd) == -1)                    \
-      { emacs_close (fd); return -1; }         \
-    sigunblock (sigmask (SIGCLD));             \
-    if (unlockpt (fd) == -1)                   \
-      { emacs_close (fd); return -1; }         \
-    if (!(ptyname = ptsname (fd)))             \
-      { emacs_close (fd); return -1; }         \
-    snprintf (pty_name, sizeof pty_name, "%s", ptyname); \
-  }
-
 #define GC_SETJMP_WORKS 1

=== modified file 'src/s/unixware.h'
--- a/src/s/unixware.h  2012-07-10 21:48:34 +0000
+++ b/src/s/unixware.h  2012-07-12 07:43:05 +0000
@@ -20,29 +20,6 @@
 
 #include "usg5-4-common.h"
 
-/* This is the same definition as in usg5-4-common.h, but with 
sigblock/sigunblock
-   rather than sighold/sigrelse, which appear to be BSD4.1 specific.
-   It may also be appropriate for SVR4.x
-   (x<2) but I'm not sure.   address@hidden */
-/* This sets the name of the slave side of the PTY.  On SysVr4,
-   grantpt(3) forks a subprocess, so keep sigchld_handler() from
-   intercepting that death.  If any child but grantpt's should die
-   within, it should be caught after sigrelse(2).  */
-#define PTY_TTY_NAME_SPRINTF                   \
-  {                                            \
-    char *ptsname (int), *ptyname;             \
-                                               \
-    sigblock(sigmask(SIGCLD));                 \
-    if (grantpt(fd) == -1)                     \
-      fatal("could not grant slave pty");      \
-    sigunblock(sigmask(SIGCLD));               \
-    if (unlockpt(fd) == -1)                    \
-      fatal("could not unlock slave pty");     \
-    if (!(ptyname = ptsname(fd)))              \
-      fatal ("could not enable slave pty");    \
-    snprintf (pty_name, sizeof pty_name, "%s", ptyname); \
-  }
-
 /* Conservative garbage collection has not been tested, so for now
    play it safe and stick with the old-fashioned way of marking.  */
 #define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE

=== modified file 'src/s/usg5-4-common.h'
--- a/src/s/usg5-4-common.h     2012-07-12 06:34:40 +0000
+++ b/src/s/usg5-4-common.h     2012-07-12 07:43:05 +0000
@@ -64,9 +64,6 @@
    this is all we need.  */
 #define TIOCSIGSEND TIOCSIGNAL
 
-/* This sets the name of the master side of the PTY.  */
-#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
-
 /* Push various streams modules onto a PTY channel.  */
 #define SETUP_SLAVE_PTY \
   if (ioctl (xforkin, I_PUSH, "ptem") == -1)   \


reply via email to

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