annotate src/s/linux.h @ 367:a4f53d9b3154 r21-1-13

Import from CVS: tag r21-1-13
author cvs
date Mon, 13 Aug 2007 11:01:07 +0200
parents 30d2cfa1092a
children cc15677e0335
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* This file is the configuration file for the GNU/Linux operating system,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 prior to version 1.1.56.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1985, 1986, 1992, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 This file is part of GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 /* Synched up with: FSF 19.31 (called, ahem ... lignux.h in FSF). */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 /* This file was put together by Michael K. Johnson and Rik Faith. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #define USG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 #define LINUX
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 /* SYSTEM_TYPE should indicate the kind of system you are using.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 It sets the Lisp variable system-type. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #define SYSTEM_TYPE "linux" /* All the best software is free. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #define FIRST_PTY_LETTER 'p'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #define HAVE_PTYS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 /* define MAIL_USE_FLOCK if the mailer uses flock
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 to interlock access to /usr/spool/mail/$USER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 The alternative is that a lock file named
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 /usr/spool/mail/$USER.lock. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 /* Both are used in Linux by different mail programs. I assume that most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 people are using newer mailers that have heard of flock. Change this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 if you need to. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 4
diff changeset
46 /*#define MAIL_USE_FLOCK*/
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 /* Here, on a separate page, add any special hacks needed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 to make Emacs work on this system. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 you might define certain system call names that don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 exist on your system, or that do different things on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 your system and must be used only through an encapsulation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (Which you should place, by convention, in sysdep.c). */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 /* On POSIX systems the system calls are interruptible by signals
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 that the user program has elected to catch. Thus the system call
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 must be retried in these cases. To handle this without massive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 changes in the source code, we remap the standard system call names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 to names for our own functions in sysdep.c that do the system call
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 with retries. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 #define INTERRUPTIBLE_OPEN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 #define INTERRUPTIBLE_CLOSE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 #define INTERRUPTIBLE_IO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 /* This is needed for dispnew.c:update_frame */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
68 #ifndef NOT_C_CODE
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 #include <stdio.h> /* Get the definition of _IO_STDIO_H. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 #if defined(_IO_STDIO_H) || defined(_STDIO_USES_IOSTREAM)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 /* new C libio names */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 #else /* !_IO_STDIO_H */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 /* old C++ iostream names */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ((FILE)->_pptr - (FILE)->_pbase)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 #endif /* !_IO_STDIO_H */
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
79 #endif /* C_CODE */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 /* Ask GCC where to find libgcc.a. */
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
82 #define LIB_GCC "`$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name`"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 #ifndef __ELF__
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 /* Linux has crt0.o in a non-standard place */
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
86 #define START_FILES "pre-crt0.o /usr/lib/crt0.o"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 #else
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
88 /**/
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
89 #if defined(__linux__) && defined(powerpc) /*Added by Fukui*/
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
90 #define START_FILES /*Added by Fukui*/
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
91 #else /*Added by Fukui*/
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
92
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
93 #define START_FILES "pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o"
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
94 #endif /*Added by Fukui*/
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 /* This is needed for sysdep.c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 #define NO_SIOCTL_H /* don't have sioctl.h */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 #define HAVE_SYS_SIGLIST
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 #define HAVE_WAIT_HEADER
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 #define POSIX /* affects getpagesize.h and systty.h */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 /* Best not to include -lg, unless it is last on the command line */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 #define LIBS_DEBUG
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
108 #define LIBS_TERMCAP "-ltermcap -lcurses" /* save some space with shared libs*/
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 #ifndef __ELF__
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
110 #define LIB_STANDARD "-lc" /* avoid -lPW */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 #else
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 243
diff changeset
112 /*#undef LIB_GCC
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 243
diff changeset
113 #define LIB_GCC*/
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
114 #define LIB_STANDARD "-lgcc -lc -lgcc /usr/lib/crtn.o"
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 243
diff changeset
115 #define LINKER "$(CC) -nostdlib"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 #ifdef TERM
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
119 #define LIBS_SYSTEM "-lclient"
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
120 #define C_SWITCH_SYSTEM "-I/usr/src/term"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 /* alane@wozzle.linet.org says that -lipc is not a separate library,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 since libc-4.4.1. So -lipc was deleted. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 #define LIBS_SYSTEM
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
125 #endif
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
126
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 #ifdef __ELF__
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
128 #define UNEXEC "unexelf.o"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 #define UNEXEC_USE_MAP_PRIVATE
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 243
diff changeset
130 #if 0
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
131 /* mrb - Ordinary link is simple and effective */
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 243
diff changeset
132 /* slb - Not any more ... :-( */
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
133 #define ORDINARY_LINK
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
134 #undef LIB_STANDARD
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
135 #undef START_FILES
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
136 #undef LIB_GCC
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 243
diff changeset
137 #endif
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
138 #endif /* __ELF__ */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 #ifdef LINUX_QMAGIC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 #define HAVE_TEXT_START
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
143 #define UNEXEC "unexsunos4.o"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 #define N_PAGSIZ(x) PAGE_SIZE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 #else /* not LINUX_QMAGIC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 #define A_TEXT_OFFSET(hdr) (N_MAGIC(hdr) == QMAGIC ? sizeof (struct exec) : 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 #define A_TEXT_SEEK(hdr) (N_TXTOFF(hdr) + A_TEXT_OFFSET(hdr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 #define ADJUST_EXEC_HEADER \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 unexec_text_start = N_TXTADDR(ohdr) + A_TEXT_OFFSET(ohdr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 #endif /* not LINUX_QMAGIC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 /* This is to work around mysterious gcc failures in some system versions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 It is unlikely that Emacs changes will work around this problem;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 therefore, this should remain permanently. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 #ifndef HAVE_XRMSETDATABASE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 #define HAVE_XRMSETDATABASE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 /* The regex.o routines are a part of the GNU C-library used with Linux. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 /* However, sometimes they disagree with the src/regex.h that comes with Emacs,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 and that can make trouble in etags.c because it gets the regex.h from Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 and the function definitions in libc. So turn this off. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 /* XEmacs: in any case, Mule uses different regex routines. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 /* #define REGEXP_IN_LIBC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 /* XEmacs change: the standard linux libc includes regex routines in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 it. We have to use our own and have to avoid name conflicts. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 #define re_compile_pattern sys_re_compile_pattern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 #define re_search sys_re_search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 #define re_search_2 sys_re_search_2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 #define re_match_2 sys_re_match_2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 #define re_max_failures sys_re_max_failures
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 #define re_set_syntax sys_re_set_syntax
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 #define re_set_registers sys_re_set_registers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 #define re_compile_fastmap sys_re_compile_fastmap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 #define re_match sys_re_match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 #define regcomp sys_regcomp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 #define regexec sys_regexec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 #define regerror sys_regerror
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 #define regfree sys_regfree
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
186 #if 0 /* mrb - if autoconf 2 is wrong, we should fix the test */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 /* XEmacs: Damon Lipparelli says that he incorrectly gets this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 defined on his system */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 #undef GETTIMEOFDAY_ONE_ARGUMENT
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 159
diff changeset
190 #endif /* 0 */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 /* Use BSD process groups, but use setpgid() instead of setpgrp() to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 actually set a process group. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 /* XEmacs: removed setpgrp() definition because we use setpgid() when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 it's available, and autodetect it. */
365
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
197
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
198 #if defined(HAVE_GRANTPT) && defined(HAVE_UNLOCKPT) && defined(HAVE_PTSNAME)
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
199 /* UNIX98 PTYs are available.
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
200 Added by Florian Weimer <Florian.Weimer@RUS.Uni-Stuttgart.DE>,
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
201 RUS-CERT, University of Stuttgart. Based on Emacs code for DGUX. */
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
202
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
203 #define PTY_ITERATION for (i = 0; i < 1; i++)
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
204 /* no iteration at all */
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
205
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
206 /* Use getpt() if it's available, because it provides Unix98 PTY
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
207 emulation for kernels which doesn't support it natively. */
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
208
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
209 #ifdef HAVE_GETPT
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
210 #define PTY_OPEN \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
211 do { \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
212 fd = getpt(); \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
213 if (fcntl (fd, F_SETFL, O_NDELAY) == -1) \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
214 fatal ("could not set master PTY to non-block mode"); \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
215 } while (0)
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
216
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
217 #else
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
218 /* the master PTY device */
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
219 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
220 #endif
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
221
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
222 /* This sets the name of the slave side of the PTY. grantpt(3) and
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
223 unlockpt(3) may fork a subprocess, so keep sigchld_handler() from
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
224 intercepting that death. */
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
225
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
226 #define PTY_TTY_NAME_SPRINTF \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
227 { \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
228 char *ptsname(), *ptyname; \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
229 \
367
a4f53d9b3154 Import from CVS: tag r21-1-13
cvs
parents: 365
diff changeset
230 EMACS_BLOCK_SIGNAL (SIGCHLD); \
365
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
231 if (grantpt(fd) == -1) \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
232 fatal("could not grant slave pty"); \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
233 if (unlockpt(fd) == -1) \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
234 fatal("could not unlock slave pty"); \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
235 if (!(ptyname = ptsname(fd))) \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
236 fatal ("could not enable slave pty"); \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
237 strncpy(pty_name, ptyname, sizeof(pty_name)); \
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
238 pty_name[sizeof(pty_name) - 1] = 0; \
367
a4f53d9b3154 Import from CVS: tag r21-1-13
cvs
parents: 365
diff changeset
239 EMACS_UNBLOCK_SIGNAL (SIGCHLD); \
365
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
240 }
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
241
30d2cfa1092a Import from CVS: tag r21-1-12
cvs
parents: 276
diff changeset
242 #endif