Commit 0ab7b23a authored by Glenn Morris's avatar Glenn Morris

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.
parent 6e777848
......@@ -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.
......
......@@ -3298,6 +3298,7 @@ dnl Only used if !PTY_ITERATION. Iterate from FIRST_PTY_LETTER to z,
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 @@ case $opsys in
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 @@ case $opsys in
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 @@ case $opsys in
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 )
......
2012-07-12 Glenn Morris <rgm@gnu.org>
* 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.
......
......@@ -19,19 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#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
......@@ -32,19 +32,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#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. */
......
......@@ -30,7 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#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 */
......
......@@ -34,26 +34,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment