comparison src/s/gnu-linux.h @ 26212:539733154e0a

[HAVE_DEV_PTMX]: Redefine FIRST_PTY_LETTER to 'z'. Define PTY_NAME_SPRINTF. Redefine PTY_TTY_NAME_SPRINTF.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 27 Oct 1999 10:22:21 +0000
parents 63fd40a97a75
children 94eb27ce53aa
comparison
equal deleted inserted replaced
26211:df0efa93750b 26212:539733154e0a
56 56
57 /* Letter to use in finding device name of first pty, 57 /* Letter to use in finding device name of first pty,
58 if system supports pty's. 'p' means it is /dev/ptyp0 */ 58 if system supports pty's. 'p' means it is /dev/ptyp0 */
59 59
60 #define FIRST_PTY_LETTER 'p' 60 #define FIRST_PTY_LETTER 'p'
61
62 #ifdef HAVE_DEV_PTMX
63
64 /* This is the same definition as in usg5-4.h, but with sigblock/sigunblock
65 rather than sighold/sigrelse, which appear to be BSD4.1 specific and won't
66 work if POSIX_SIGNALS is defined. It may also be appropriate for SVR4.x
67 (x<2) but I'm not sure. fnf@cygnus.com */
68 /* This sets the name of the slave side of the PTY. On SysVr4,
69 grantpt(3) forks a subprocess, so keep sigchld_handler() from
70 intercepting that death. If any child but grantpt's should die
71 within, it should be caught after sigrelse(2). */
72
73 #undef FIRST_PTY_LETTER
74 #define FIRST_PTY_LETTER 'z'
75
76 /* This sets the name of the master side of the PTY. */
77 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
78
79 #undef PTY_TTY_NAME_SPRINTF
80 #define PTY_TTY_NAME_SPRINTF \
81 { \
82 char *ptsname (), *ptyname; \
83 \
84 sigblock (sigmask (SIGCLD)); \
85 if (grantpt (fd) == -1) \
86 { close (fd); return -1; } \
87 sigunblock (sigmask (SIGCLD)); \
88 if (unlockpt (fd) == -1) \
89 { close (fd); return -1; } \
90 if (!(ptyname = ptsname (fd))) \
91 { close (fd); return -1; } \
92 strncpy (pty_name, ptyname, sizeof (pty_name)); \
93 pty_name[sizeof (pty_name) - 1] = 0; \
94 }
95
96 #endif /* HAVE_DEV_PTMX */
61 97
62 /* 98 /*
63 * Define HAVE_TERMIOS if the system provides POSIX-style 99 * Define HAVE_TERMIOS if the system provides POSIX-style
64 * functions and macros for terminal control. 100 * functions and macros for terminal control.
65 */ 101 */