428
|
1 /*
|
|
2 Copyright (C) 1995 Free Software Foundation, Inc.
|
853
|
3 Copyright (C) 2000, 2002 Ben Wing.
|
428
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Not really in FSF. */
|
|
23
|
440
|
24 #ifndef INCLUDED_sysproc_h_
|
|
25 #define INCLUDED_sysproc_h_
|
|
26
|
428
|
27 #include "systime.h" /* necessary for sys/resource.h; also gets the
|
|
28 FD_* defines on some systems. */
|
442
|
29 #ifndef WIN32_NATIVE
|
428
|
30 #include <sys/resource.h>
|
|
31 #endif
|
|
32
|
|
33 #if !defined (NO_SUBPROCESSES)
|
|
34
|
771
|
35 #ifdef MINGW
|
|
36 #include <../mingw/process.h>
|
|
37 #elif defined (CYGWIN)
|
|
38 #include <../include/process.h>
|
|
39 #elif defined (WIN32_NATIVE)
|
|
40 /* <process.h> should not conflict with "process.h", as per ANSI definition.
|
|
41 This is not true with visual c though. The trick below works with
|
|
42 VC4.2b, 5.0 and 6.0. It assumes that VC is installed in a kind of
|
|
43 standard way, so include path ends with /include.
|
|
44 NOTE: We also include this same file in s/windowsnt.h, to avoid problems
|
|
45 because this file prototypes abort() and then lisp.h defines it as a
|
|
46 macro, which must happen after the prototype. DO NOT remove the include
|
|
47 here just because you "know" it's somewhere else as well.
|
|
48 */
|
|
49 #include <../include/process.h>
|
|
50 #endif
|
|
51
|
428
|
52 #ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */
|
|
53 # include <sys/types.h> /* AJK */
|
442
|
54 # ifndef WIN32_NATIVE
|
|
55 # include <sys/socket.h>
|
|
56 # include <netdb.h>
|
|
57 # include <netinet/in.h>
|
|
58 # include <arpa/inet.h>
|
|
59 # endif
|
|
60 # ifdef NEED_NET_ERRNO_H
|
|
61 # include <net/errno.h>
|
|
62 # endif /* NEED_NET_ERRNO_H */
|
428
|
63 #elif defined (SKTPAIR)
|
|
64 # include <sys/socket.h>
|
|
65 #endif /* HAVE_SOCKETS */
|
|
66
|
442
|
67 #ifdef WIN32_NATIVE
|
|
68 /* Note: winsock.h already included in systime.h above */
|
|
69 /* map winsock error codes to standard names */
|
|
70 #define EWOULDBLOCK WSAEWOULDBLOCK
|
|
71 #define EINPROGRESS WSAEINPROGRESS
|
|
72 #define EALREADY WSAEALREADY
|
|
73 #define ENOTSOCK WSAENOTSOCK
|
|
74 #define EDESTADDRREQ WSAEDESTADDRREQ
|
|
75 #define EMSGSIZE WSAEMSGSIZE
|
|
76 #define EPROTOTYPE WSAEPROTOTYPE
|
|
77 #define ENOPROTOOPT WSAENOPROTOOPT
|
|
78 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
|
79 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
|
|
80 #define EOPNOTSUPP WSAEOPNOTSUPP
|
|
81 #define EPFNOSUPPORT WSAEPFNOSUPPORT
|
|
82 #define EAFNOSUPPORT WSAEAFNOSUPPORT
|
|
83 #define EADDRINUSE WSAEADDRINUSE
|
|
84 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
|
85 #define ENETDOWN WSAENETDOWN
|
|
86 #define ENETUNREACH WSAENETUNREACH
|
|
87 #define ENETRESET WSAENETRESET
|
|
88 #define ECONNABORTED WSAECONNABORTED
|
|
89 #define ECONNRESET WSAECONNRESET
|
|
90 #define ENOBUFS WSAENOBUFS
|
|
91 #define EISCONN WSAEISCONN
|
|
92 #define ENOTCONN WSAENOTCONN
|
|
93 #define ESHUTDOWN WSAESHUTDOWN
|
|
94 #define ETOOMANYREFS WSAETOOMANYREFS
|
|
95 #define ETIMEDOUT WSAETIMEDOUT
|
|
96 #define ECONNREFUSED WSAECONNREFUSED
|
|
97 #define ELOOP WSAELOOP
|
|
98 /* #define ENAMETOOLONG WSAENAMETOOLONG */
|
|
99 #define EHOSTDOWN WSAEHOSTDOWN
|
|
100 #define EHOSTUNREACH WSAEHOSTUNREACH
|
|
101 /* #define ENOTEMPTY WSAENOTEMPTY */
|
|
102 #define EPROCLIM WSAEPROCLIM
|
|
103 #define EUSERS WSAEUSERS
|
|
104 #define EDQUOT WSAEDQUOT
|
|
105 #define ESTALE WSAESTALE
|
|
106 #define EREMOTE WSAEREMOTE
|
|
107 #endif /* WIN32_NATIVE */
|
|
108
|
428
|
109 /* On some systems, e.g. DGUX, inet_addr returns a 'struct in_addr'. */
|
|
110 #ifdef HAVE_BROKEN_INET_ADDR
|
|
111 # define IN_ADDR struct in_addr
|
|
112 # define NUMERIC_ADDR_ERROR (numeric_addr.s_addr == -1)
|
|
113 #else
|
|
114 # if (LONGBITS > 32)
|
|
115 # define IN_ADDR unsigned int
|
|
116 # else
|
|
117 # define IN_ADDR unsigned long
|
|
118 # endif
|
|
119 # define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) -1)
|
|
120 #endif
|
|
121
|
|
122 /* Define first descriptor number available for subprocesses. */
|
|
123 #define FIRST_PROC_DESC 3
|
|
124
|
|
125 #ifdef IRIS
|
|
126 # include <sys/sysmacros.h> /* for "minor" */
|
|
127 #endif /* not IRIS */
|
|
128
|
|
129 #endif /* !NO_SUBPROCESSES */
|
|
130
|
|
131 #ifdef AIX
|
|
132 #include <sys/select.h>
|
|
133 #endif
|
|
134
|
444
|
135 #ifdef HAVE_STROPTS_H
|
|
136 #include <stropts.h> /* isastream(), I_PUSH */
|
442
|
137 #endif
|
|
138
|
444
|
139 #ifdef HAVE_STRTIO_H
|
|
140 #include <strtio.h> /* TIOCSIGNAL */
|
442
|
141 #endif
|
|
142
|
|
143 #ifdef HAVE_PTY_H
|
|
144 #include <pty.h> /* openpty() on Tru64, Linux */
|
|
145 #endif
|
|
146
|
|
147 #ifdef HAVE_LIBUTIL_H
|
458
|
148 #include <libutil.h> /* openpty() on FreeBSD */
|
|
149 #endif
|
|
150
|
|
151 #ifdef HAVE_UTIL_H
|
|
152 #include <util.h> /* openpty() on NetBSD */
|
442
|
153 #endif
|
|
154
|
428
|
155 #ifdef FD_SET
|
|
156
|
|
157 /* We could get this from param.h, but better not to depend on finding that.
|
|
158 And better not to risk that it might define other symbols used in this
|
|
159 file. */
|
|
160 # ifdef FD_SETSIZE
|
|
161 # define MAXDESC FD_SETSIZE
|
|
162 # else
|
|
163 # define MAXDESC 64
|
|
164 # endif /* FD_SETSIZE */
|
|
165 # define SELECT_TYPE fd_set
|
|
166
|
|
167 #else /* no FD_SET */
|
|
168
|
|
169 # define MAXDESC 32
|
|
170 # define SELECT_TYPE int
|
|
171
|
|
172 /* Define the macros to access a single-int bitmap of descriptors. */
|
|
173 # define FD_SET(n, p) (*(p) |= (1 << (n)))
|
|
174 # define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
|
|
175 # define FD_ISSET(n, p) (*(p) & (1 << (n)))
|
|
176 # define FD_ZERO(p) (*(p) = 0)
|
|
177
|
|
178 #endif /* no FD_SET */
|
|
179
|
|
180 int poll_fds_for_input (SELECT_TYPE mask);
|
867
|
181 int qxe_execve (const Ibyte *filename, Ibyte * const argv[],
|
|
182 Ibyte * const envp[]);
|
771
|
183 pid_t qxe_getpid (void);
|
428
|
184
|
853
|
185 /* #### I would really like to delete the remaining synchronous code entirely.
|
|
186 We are now using it only for *REALLY* old systems -- how many systems
|
|
187 nowadays
|
|
188
|
|
189 (a) lack job control, or
|
|
190 (b) lack mkdir() or rmdir()
|
|
191
|
|
192 ?????
|
|
193
|
|
194 --ben
|
|
195 */
|
|
196
|
859
|
197 #include "syssignal.h" /* needed for SIGTSTP */
|
854
|
198
|
853
|
199 #if !defined (WIN32_NATIVE) && ((!defined (SIGTSTP) && !defined (USG_JOBCTRL)) || !defined (HAVE_MKDIR) || !defined (HAVE_RMDIR))
|
|
200
|
|
201 #define NEED_SYNC_PROCESS_CODE
|
|
202
|
|
203 /* True iff we are about to fork off a synchronous process or if we
|
|
204 are waiting for it. */
|
|
205 extern volatile int synch_process_alive;
|
|
206
|
|
207 /* Nonzero => this is a string explaining death of synchronous subprocess. */
|
|
208 extern const char *synch_process_death;
|
|
209
|
|
210 /* If synch_process_death is zero,
|
|
211 this is exit code of synchronous subprocess. */
|
|
212 extern int synch_process_retcode;
|
|
213
|
|
214 #endif
|
|
215
|
|
216
|
440
|
217 #endif /* INCLUDED_sysproc_h_ */
|