diff options
| author | Gerd Moellmann | 2000-05-20 15:51:13 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-05-20 15:51:13 +0000 |
| commit | 71125fb8362e9a4108943096bb7774755c25fad6 (patch) | |
| tree | da13272b8885050483522c7756e68ed3e49f3e9a /src/s/gnu-linux.h | |
| parent | 40ccc4c77030214b6234283619109a15475ddf6a (diff) | |
| download | emacs-71125fb8362e9a4108943096bb7774755c25fad6.tar.gz emacs-71125fb8362e9a4108943096bb7774755c25fad6.zip | |
(UNIX98_PTYS) [HAVE_GRANDPT]: Define.
(PTY_ITERATION, PTY_NAME_SPRINTF, PTY_OPEN, PTY_TTY_NAME_SPRINTF)
[HAVE_GRANDPT]: Define.
(C_SWITCH_SYSTEM): Add -D_XOPEN_SOURCE.
Diffstat (limited to 'src/s/gnu-linux.h')
| -rw-r--r-- | src/s/gnu-linux.h | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h index 8e39773c6c6..96ebc7a136a 100644 --- a/src/s/gnu-linux.h +++ b/src/s/gnu-linux.h | |||
| @@ -54,58 +54,56 @@ Boston, MA 02111-1307, USA. */ | |||
| 54 | #endif /* emacs */ | 54 | #endif /* emacs */ |
| 55 | #endif /* NOT_C_CODE */ | 55 | #endif /* NOT_C_CODE */ |
| 56 | 56 | ||
| 57 | /* Letter to use in finding device name of first pty, | 57 | #if defined HAVE_GRANTPT |
| 58 | if system supports pty's. 'p' means it is /dev/ptyp0 */ | 58 | #define UNIX98_PTYS |
| 59 | 59 | ||
| 60 | #define FIRST_PTY_LETTER 'p' | 60 | /* Run only once. We need a `for'-loop because the code uses |
| 61 | `continue'. */ | ||
| 61 | 62 | ||
| 62 | #ifdef HAVE_DEV_PTMX | 63 | #define PTY_ITERATION for (i = 0; i < 1; i++) |
| 63 | 64 | ||
| 64 | /* This is the same definition as in usg5-4.h, but with sigblock/sigunblock | 65 | #ifdef HAVE_GETPT |
| 65 | rather than sighold/sigrelse, which appear to be BSD4.1 specific and won't | 66 | #define PTY_NAME_SPRINTF |
| 66 | work if POSIX_SIGNALS is defined. It may also be appropriate for SVR4.x | 67 | #define PTY_OPEN fd = getpt () |
| 67 | (x<2) but I'm not sure. fnf@cygnus.com */ | 68 | #else /* not HAVE_GETPT */ |
| 68 | /* This sets the name of the slave side of the PTY. On SysVr4, | 69 | #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx"); |
| 69 | grantpt(3) forks a subprocess, so keep sigchld_handler() from | 70 | #endif /* not HAVE_GETPT */ |
| 70 | intercepting that death. If any child but grantpt's should die | 71 | |
| 71 | within, it should be caught after sigrelse(2). */ | 72 | /* Note that grantpt and unlockpt may fork. We must block SIGCHLD to |
| 73 | prevent sigchld_handler from intercepting the child's death. */ | ||
| 74 | |||
| 75 | #define PTY_TTY_NAME_SPRINTF \ | ||
| 76 | { \ | ||
| 77 | char *ptyname; \ | ||
| 78 | \ | ||
| 79 | sigblock (sigmask (SIGCHLD)); \ | ||
| 80 | if (grantpt (fd) == -1 || unlockpt (fd) == -1 \ | ||
| 81 | || !(ptyname = ptsname(fd))) \ | ||
| 82 | { \ | ||
| 83 | sigunblock (sigmask (SIGCHLD)); \ | ||
| 84 | close (fd); \ | ||
| 85 | return -1; \ | ||
| 86 | } \ | ||
| 87 | strncpy (pty_name, ptyname, sizeof (pty_name)); \ | ||
| 88 | pty_name[sizeof (pty_name) - 1] = 0; \ | ||
| 89 | sigunblock (sigmask (SIGCHLD)); \ | ||
| 90 | } | ||
| 72 | 91 | ||
| 73 | #undef FIRST_PTY_LETTER | 92 | #else /* not HAVE_GRANDPT */ |
| 74 | #define FIRST_PTY_LETTER 'z' | ||
| 75 | 93 | ||
| 76 | /* This sets the name of the master side of the PTY. */ | 94 | /* Letter to use in finding device name of first pty, |
| 77 | #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx"); | 95 | if system supports pty's. 'p' means it is /dev/ptyp0 */ |
| 78 | 96 | ||
| 79 | #undef PTY_TTY_NAME_SPRINTF | 97 | #define FIRST_PTY_LETTER 'p' |
| 80 | /* This used to use SIGCLD, but that doesn't appear in glibc 2.1. */ | ||
| 81 | #define PTY_TTY_NAME_SPRINTF \ | ||
| 82 | { \ | ||
| 83 | char *ptsname (), *ptyname; \ | ||
| 84 | \ | ||
| 85 | sigblock (sigmask (SIGCHLD)); \ | ||
| 86 | if (grantpt (fd) == -1) \ | ||
| 87 | { close (fd); return -1; } \ | ||
| 88 | sigunblock (sigmask (SIGCHLD)); \ | ||
| 89 | if (unlockpt (fd) == -1) \ | ||
| 90 | { close (fd); return -1; } \ | ||
| 91 | if (!(ptyname = ptsname (fd))) \ | ||
| 92 | { close (fd); return -1; } \ | ||
| 93 | strncpy (pty_name, ptyname, sizeof (pty_name)); \ | ||
| 94 | pty_name[sizeof (pty_name) - 1] = 0; \ | ||
| 95 | } | ||
| 96 | 98 | ||
| 97 | #endif /* HAVE_DEV_PTMX */ | 99 | #endif /* not HAVE_GRANDPT */ |
| 98 | 100 | ||
| 99 | /* | 101 | /* Define HAVE_TERMIOS if the system provides POSIX-style |
| 100 | * Define HAVE_TERMIOS if the system provides POSIX-style | 102 | functions and macros for terminal control. */ |
| 101 | * functions and macros for terminal control. | ||
| 102 | */ | ||
| 103 | 103 | ||
| 104 | #define HAVE_TERMIOS | 104 | #define HAVE_TERMIOS |
| 105 | 105 | ||
| 106 | /* | 106 | /* Define HAVE_PTYS if the system supports pty devices. */ |
| 107 | * Define HAVE_PTYS if the system supports pty devices. | ||
| 108 | */ | ||
| 109 | 107 | ||
| 110 | #define HAVE_PTYS | 108 | #define HAVE_PTYS |
| 111 | 109 | ||
| @@ -249,7 +247,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 249 | /* alane@wozzle.linet.org says that -lipc is not a separate library, | 247 | /* alane@wozzle.linet.org says that -lipc is not a separate library, |
| 250 | since libc-4.4.1. So -lipc was deleted. */ | 248 | since libc-4.4.1. So -lipc was deleted. */ |
| 251 | #define LIBS_SYSTEM | 249 | #define LIBS_SYSTEM |
| 252 | #define C_SWITCH_SYSTEM -D_BSD_SOURCE | 250 | #define C_SWITCH_SYSTEM -D_BSD_SOURCE -D_XOPEN_SOURCE |
| 253 | #endif | 251 | #endif |
| 254 | 252 | ||
| 255 | /* Paul Abrahams <abrahams@equinox.shaysnet.com> says this is needed. */ | 253 | /* Paul Abrahams <abrahams@equinox.shaysnet.com> says this is needed. */ |