]> code.delx.au - gnu-emacs/blob - src/s/usg5-4.h
(PTY_TTY_NAME_SPRINTF): Fail smoothly if cannot get pty.
[gnu-emacs] / src / s / usg5-4.h
1 /* Definitions file for GNU Emacs running on AT&T's System V Release 4
2 Copyright (C) 1987, 1990 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 /* This file written by James Van Artsdalen of Dell Computer Corporation.
21 * james@bigtex.cactus.org. Subsequently improved for Dell 2.2 by Eric
22 * S. Raymond <esr@snark.thyrsus.com>.
23 */
24
25 /* Use the SysVr3 file for at least base configuration. */
26
27 #include "usg5-3.h"
28
29 #define USG5_4
30
31 /* On most SVR4 systems, gettimeofday takes one arg
32 and the compiler might crash. */
33 #define GETTIMEOFDAY_ONE_ARGUMENT
34
35 /* We do have multiple jobs. Handle ^Z. */
36
37 #undef NOMULTIPLEJOBS
38
39 #define LIBS_SYSTEM -lsocket -lnsl -lelf
40 #define ORDINARY_LINK
41
42 #if 0
43 #ifdef ORDINARY_LINK
44 #define LIB_STANDARD -lc /usr/ucblib/libucb.a
45 #else
46 #define START_FILES pre-crt0.o /usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xt.o
47 #define LIB_STANDARD -lc /usr/ucblib/libucb.a /usr/ccs/lib/crtn.o
48 #endif
49 #else
50
51 #ifdef ORDINARY_LINK
52 #define LIB_STANDARD
53 #else
54 #define START_FILES pre-crt0.o /usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xt.o
55 #define LIB_STANDARD -lc /usr/ccs/lib/crtn.o
56 #endif
57 #endif
58
59 /* there are no -lg libraries on this system, and no libPW */
60
61 #define LIBS_DEBUG
62 #define LIBS_STANDARD -lc
63
64 /* No <sioctl.h> */
65
66 #define NO_SIOCTL_H
67
68 /* Undump with ELF */
69
70 #undef COFF
71
72 #define UNEXEC unexelf.o
73
74 /* Get FIONREAD from <sys/filio.h>. Get <sys/ttold.h> to get struct
75 * tchars. But get <termio.h> first to make sure ttold.h doesn't
76 * interfere. And don't try to use SIGIO yet.
77 */
78
79 #ifdef emacs
80 #include <sys/filio.h>
81 #include <termio.h>
82 #include <sys/ttold.h>
83 #include <signal.h>
84 #include <sys/wait.h>
85 #include <sys/stream.h>
86 #include <sys/stropts.h>
87 #include <sys/termios.h>
88 #undef SIGIO
89 #endif
90
91 /* Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
92 * instead, there's a system variable _sys_nsig. Unfortunately, we need the
93 * constant to dimension an array. So wire in the appropriate value here.
94 */
95
96 #ifndef NSIG
97 #define NSIG 32
98 #endif
99
100 /* libc has this stuff, but not utimes. */
101
102 #define HAVE_SELECT
103 #define HAVE_TIMEVAL
104
105 /* <sys/stat.h> *defines* stat(2) as a static function. If "static"
106 * is blank, then many files will have a public definition for stat(2).
107 */
108
109 #undef static
110
111 /* We need bss_end from emacs.c for undumping */
112
113 #ifndef USG_SHARED_LIBRARIES
114 #define USG_SHARED_LIBRARIES
115 #endif
116
117 /* We can support this */
118
119 #define CLASH_DETECTION
120
121 #define HAVE_PTYS
122 #define HAVE_TERMIOS
123 #undef BROKEN_TIOCGWINSZ
124 #undef BROKEN_TIOCGETC
125
126 /* It is possible to receive SIGCHLD when there are no children
127 waiting, because a previous waitsys(2) cleaned up the carcass of child
128 without clearing the SIGCHLD pending info. So, use a non-blocking
129 wait3 instead, which maps to waitpid(2) in SysVr4. */
130
131 #define HAVE_WAIT_HEADER
132 #define WAITTYPE int
133 #define wait3(status, options, rusage) \
134 waitpid ((pid_t) -1, (status), (options))
135 #define WRETCODE(w) (w >> 8)
136
137 /* TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
138 subprocesses the usual way. But TIOCSIGNAL does work for PTYs, and
139 this is all we need. */
140
141 #define TIOCSIGSEND TIOCSIGNAL
142
143 /* This change means that we don't loop through allocate_pty too many
144 times in the (rare) event of a failure. */
145
146 #undef FIRST_PTY_LETTER
147 #define FIRST_PTY_LETTER 'z'
148
149 /* This sets the name of the master side of the PTY. */
150
151 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
152
153 /* This sets the name of the slave side of the PTY. On SysVr4,
154 grantpt(3) forks a subprocess, so keep sigchld_handler() from
155 intercepting that death. If any child but grantpt's should die
156 within, it should be caught after sigrelse(2). */
157
158 #define PTY_TTY_NAME_SPRINTF \
159 { \
160 char *ptsname (), *ptyname; \
161 \
162 sighold (SIGCLD); \
163 if (grantpt (fd) == -1) \
164 { close (fd); return -1; } \
165 sigrelse (SIGCLD); \
166 if (unlockpt (fd) == -1) \
167 { close (fd); return -1; } \
168 if (!(ptyname = ptsname (fd))) \
169 { close (fd); return -1; } \
170 strncpy (pty_name, ptyname, sizeof (pty_name)); \
171 pty_name[sizeof (pty_name) - 1] = 0; \
172 }
173
174 /* Push various streams modules onto a PTY channel. */
175
176 #define SETUP_SLAVE_PTY \
177 if (ioctl (xforkin, I_PUSH, "ptem") == -1) \
178 fatal ("ioctl I_PUSH ptem", errno); \
179 if (ioctl (xforkin, I_PUSH, "ldterm") == -1) \
180 fatal ("ioctl I_PUSH ldterm", errno); \
181 if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) \
182 fatal ("ioctl I_PUSH ttcompat", errno);
183
184 /* Undo the SVr3 X11 library definition */
185 #undef LIB_X11_LIB
186
187 /* The definition of this in s-usg5-3.h is not needed in 5.4. */
188 /* liblnsl_s should never be used. The _s suffix implies a shared
189 library, as opposed to a DLL. Share libraries were used in SVR3, and are
190 available only in order to allow SVR3 binaries to run. They should not be
191 linked in to new binaries. -- caraway!pinkas@caraway.intel.com. */
192 #undef LIBX10_SYSTEM
193 #undef LIBX11_SYSTEM
194
195 /* Tell x11term.c and keyboard.c we have the system V streams feature. */
196 #define SYSV_STREAMS
197
198 /* This definition was suggested for next release.
199 So give it a try. */
200 #define HAVE_SOCKETS
201
202 #define bcopy(src,dst,n) memmove (dst,src,n)
203 #define bcmp(src,dst,n) memcmp (src,dst,n)
204 #define bzero(s,n) memset (s,0,n)