emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109047: Move PTY_OPEN from src/s to


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109047: Move PTY_OPEN from src/s to configure
Date: Thu, 12 Jul 2012 00:10:44 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109047
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Thu 2012-07-12 00:10:44 -0700
message:
  Move PTY_OPEN from src/s to configure
  
  * configure.ac (PTY_OPEN) Move here from src/s.
  
  * src/s/cygwin.h, src/s/darwin.h, src/s/gnu-linux.h, src/s/irix6-5.h:
  Move PTY_OPEN to configure.
modified:
  ChangeLog
  configure.ac
  src/ChangeLog
  src/s/cygwin.h
  src/s/darwin.h
  src/s/gnu-linux.h
  src/s/irix6-5.h
=== modified file 'ChangeLog'
--- a/ChangeLog 2012-07-12 06:34:40 +0000
+++ b/ChangeLog 2012-07-12 07:10:44 +0000
@@ -6,7 +6,7 @@
        * configure.ac (NARROWPROTO, NO_ABORT, BROKEN_GET_CURRENT_DIR_NAME)
        (BROKEN_FIONREAD, BROKEN_PTY_READ_AFTER_EAGAIN, BROKEN_SIGAIO)
        (BROKEN_SIGPOLL, BROKEN_SIGPTY, FIRST_PTY_LETTER)
-       (G_SLICE_ALWAYS_MALLOC, PREFER_VSUSP, PTY_ITERATION)
+       (G_SLICE_ALWAYS_MALLOC, PREFER_VSUSP, PTY_ITERATION, PTY_OPEN)
        (RUN_TIME_REMAP, SETPGRP_RELEASES_CTTY, TAB3, TABDLY, RUN_TIME_REMAP
        (XOS_NEEDS_TIME_H): Move here from src/s.
 

=== modified file 'configure.ac'
--- a/configure.ac      2012-07-12 06:34:40 +0000
+++ b/configure.ac      2012-07-12 07:10:44 +0000
@@ -3298,6 +3298,7 @@
 dnl trying suffixes 0-16.
 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.])
 
 case $opsys in
   aix4-2 )
@@ -3306,12 +3307,18 @@
 
   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)] )
     ;;
 
   darwin )
     AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)] )
     dnl Not used, because PTY_ITERATION is defined.
     AC_DEFINE(FIRST_PTY_LETTER, ['p'])
+    dnl Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
+    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)] )
     ;;
 
   gnu | hpux* | freebsd | netbsd | openbsd )
@@ -3322,6 +3329,10 @@
     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 if HAVE_GETPT
+      if test "x$ac_cv_func_getpt" = xyes; then
+        AC_DEFINE(PTY_OPEN, [fd = getpt ()])
+      fi
     else
       AC_DEFINE(FIRST_PTY_LETTER, ['p'])
     fi
@@ -3341,6 +3352,7 @@
     AC_DEFINE(PTY_ITERATION, [])
     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); }] )
     ;;
 
   sol2* | unixware )

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-12 06:34:40 +0000
+++ b/src/ChangeLog     2012-07-12 07:10:44 +0000
@@ -1,5 +1,8 @@
 2012-07-12  Glenn Morris  <address@hidden>
 
+       * s/cygwin.h, s/darwin.h, s/gnu-linux.h, s/irix6-5.h:
+       Move PTY_OPEN to configure.
+
        * s/aix4-2.h, s/bsd-common.h, s/cygwin.h, s/darwin.h:
        * s/gnu-linux.h, s/hpux10-20.h, s/irix6-5.h, s/template.h:
        * s/usg5-4-common.h: Move FIRST_PTY_LETTER, PTY_ITERATION to configure.

=== modified file 'src/s/cygwin.h'
--- a/src/s/cygwin.h    2012-07-12 06:34:40 +0000
+++ b/src/s/cygwin.h    2012-07-12 07:10:44 +0000
@@ -19,19 +19,6 @@
 
 #define PTY_NAME_SPRINTF       /* none */
 #define PTY_TTY_NAME_SPRINTF   /* none */
-#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)
 
 /* 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 06:34:40 +0000
+++ b/src/s/darwin.h    2012-07-12 07:10:44 +0000
@@ -32,19 +32,6 @@
 
 #define PTY_NAME_SPRINTF       /* none */
 #define PTY_TTY_NAME_SPRINTF   /* none */
-/* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
-   But we don't have to block SIGCHLD because it is blocked in the
-   implementation of grantpt.  */
-#define PTY_OPEN                                               \
-  do                                                           \
-    {                                                          \
-      int slave;                                               \
-      if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1)   \
-       fd = -1;                                                \
-      else                                                     \
-       emacs_close (slave);                                    \
-    }                                                          \
-  while (0)
 
 /* PTYs only work correctly on Darwin 7 or higher.  So make the default
    for process-connection-type dependent on the kernel version.  */

=== modified file 'src/s/gnu-linux.h'
--- a/src/s/gnu-linux.h 2012-07-12 06:34:40 +0000
+++ b/src/s/gnu-linux.h 2012-07-12 07:10:44 +0000
@@ -30,7 +30,6 @@
 
 #ifdef HAVE_GETPT
 #define PTY_NAME_SPRINTF
-#define PTY_OPEN fd = getpt ()
 #else /* not HAVE_GETPT */
 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
 #endif /* not HAVE_GETPT */

=== modified file 'src/s/irix6-5.h'
--- a/src/s/irix6-5.h   2012-07-12 06:34:40 +0000
+++ b/src/s/irix6-5.h   2012-07-12 07:10:44 +0000
@@ -34,26 +34,6 @@
 #ifdef emacs
 char *_getpty();
 #endif
-/* Here is how to do it.  */
-#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);                                 \
-}
 
 /* Ulimit(UL_GMEMLIM) is busted...  */
 #define ULIMIT_BREAK_VALUE 0x14000000


reply via email to

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