428
|
1 /*
|
|
2 Copyright (C) 1995 Free Software Foundation, Inc.
|
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 /* Synched up with: Not really in FSF. */
|
|
22
|
440
|
23 #ifndef INCLUDED_sysproc_h_
|
|
24 #define INCLUDED_sysproc_h_
|
|
25
|
428
|
26 #ifdef HAVE_VFORK_H
|
|
27 # include <vfork.h>
|
|
28 #endif
|
|
29
|
|
30 #include "systime.h" /* necessary for sys/resource.h; also gets the
|
|
31 FD_* defines on some systems. */
|
442
|
32 #ifndef WIN32_NATIVE
|
428
|
33 #include <sys/resource.h>
|
|
34 #endif
|
|
35
|
|
36 #if !defined (NO_SUBPROCESSES)
|
|
37
|
|
38 #ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */
|
|
39 # include <sys/types.h> /* AJK */
|
442
|
40 # ifndef WIN32_NATIVE
|
|
41 # include <sys/socket.h>
|
|
42 # include <netdb.h>
|
|
43 # include <netinet/in.h>
|
|
44 # include <arpa/inet.h>
|
|
45 # endif
|
|
46 # ifdef NEED_NET_ERRNO_H
|
|
47 # include <net/errno.h>
|
|
48 # endif /* NEED_NET_ERRNO_H */
|
428
|
49 #elif defined (SKTPAIR)
|
|
50 # include <sys/socket.h>
|
|
51 #endif /* HAVE_SOCKETS */
|
|
52
|
442
|
53 #ifdef WIN32_NATIVE
|
|
54 /* Note: winsock.h already included in systime.h above */
|
|
55 /* map winsock error codes to standard names */
|
|
56 #define EWOULDBLOCK WSAEWOULDBLOCK
|
|
57 #define EINPROGRESS WSAEINPROGRESS
|
|
58 #define EALREADY WSAEALREADY
|
|
59 #define ENOTSOCK WSAENOTSOCK
|
|
60 #define EDESTADDRREQ WSAEDESTADDRREQ
|
|
61 #define EMSGSIZE WSAEMSGSIZE
|
|
62 #define EPROTOTYPE WSAEPROTOTYPE
|
|
63 #define ENOPROTOOPT WSAENOPROTOOPT
|
|
64 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
|
65 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
|
|
66 #define EOPNOTSUPP WSAEOPNOTSUPP
|
|
67 #define EPFNOSUPPORT WSAEPFNOSUPPORT
|
|
68 #define EAFNOSUPPORT WSAEAFNOSUPPORT
|
|
69 #define EADDRINUSE WSAEADDRINUSE
|
|
70 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
|
71 #define ENETDOWN WSAENETDOWN
|
|
72 #define ENETUNREACH WSAENETUNREACH
|
|
73 #define ENETRESET WSAENETRESET
|
|
74 #define ECONNABORTED WSAECONNABORTED
|
|
75 #define ECONNRESET WSAECONNRESET
|
|
76 #define ENOBUFS WSAENOBUFS
|
|
77 #define EISCONN WSAEISCONN
|
|
78 #define ENOTCONN WSAENOTCONN
|
|
79 #define ESHUTDOWN WSAESHUTDOWN
|
|
80 #define ETOOMANYREFS WSAETOOMANYREFS
|
|
81 #define ETIMEDOUT WSAETIMEDOUT
|
|
82 #define ECONNREFUSED WSAECONNREFUSED
|
|
83 #define ELOOP WSAELOOP
|
|
84 /* #define ENAMETOOLONG WSAENAMETOOLONG */
|
|
85 #define EHOSTDOWN WSAEHOSTDOWN
|
|
86 #define EHOSTUNREACH WSAEHOSTUNREACH
|
|
87 /* #define ENOTEMPTY WSAENOTEMPTY */
|
|
88 #define EPROCLIM WSAEPROCLIM
|
|
89 #define EUSERS WSAEUSERS
|
|
90 #define EDQUOT WSAEDQUOT
|
|
91 #define ESTALE WSAESTALE
|
|
92 #define EREMOTE WSAEREMOTE
|
|
93 #endif /* WIN32_NATIVE */
|
|
94
|
428
|
95 /* On some systems, e.g. DGUX, inet_addr returns a 'struct in_addr'. */
|
|
96 #ifdef HAVE_BROKEN_INET_ADDR
|
|
97 # define IN_ADDR struct in_addr
|
|
98 # define NUMERIC_ADDR_ERROR (numeric_addr.s_addr == -1)
|
|
99 #else
|
|
100 # if (LONGBITS > 32)
|
|
101 # define IN_ADDR unsigned int
|
|
102 # else
|
|
103 # define IN_ADDR unsigned long
|
|
104 # endif
|
|
105 # define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) -1)
|
|
106 #endif
|
|
107
|
|
108 /* Define first descriptor number available for subprocesses. */
|
|
109 #define FIRST_PROC_DESC 3
|
|
110
|
|
111 #ifdef IRIS
|
|
112 # include <sys/sysmacros.h> /* for "minor" */
|
|
113 #endif /* not IRIS */
|
|
114
|
|
115 #endif /* !NO_SUBPROCESSES */
|
|
116
|
|
117 #ifdef AIX
|
|
118 #include <sys/select.h>
|
|
119 #endif
|
|
120
|
444
|
121 #ifdef HAVE_STROPTS_H
|
|
122 #include <stropts.h> /* isastream(), I_PUSH */
|
442
|
123 #endif
|
|
124
|
444
|
125 #ifdef HAVE_STRTIO_H
|
|
126 #include <strtio.h> /* TIOCSIGNAL */
|
442
|
127 #endif
|
|
128
|
|
129 #ifdef HAVE_PTY_H
|
|
130 #include <pty.h> /* openpty() on Tru64, Linux */
|
|
131 #endif
|
|
132
|
|
133 #ifdef HAVE_LIBUTIL_H
|
458
|
134 #include <libutil.h> /* openpty() on FreeBSD */
|
|
135 #endif
|
|
136
|
|
137 #ifdef HAVE_UTIL_H
|
|
138 #include <util.h> /* openpty() on NetBSD */
|
442
|
139 #endif
|
|
140
|
428
|
141 #ifdef FD_SET
|
|
142
|
|
143 /* We could get this from param.h, but better not to depend on finding that.
|
|
144 And better not to risk that it might define other symbols used in this
|
|
145 file. */
|
|
146 # ifdef FD_SETSIZE
|
|
147 # define MAXDESC FD_SETSIZE
|
|
148 # else
|
|
149 # define MAXDESC 64
|
|
150 # endif /* FD_SETSIZE */
|
|
151 # define SELECT_TYPE fd_set
|
|
152
|
|
153 #else /* no FD_SET */
|
|
154
|
|
155 # define MAXDESC 32
|
|
156 # define SELECT_TYPE int
|
|
157
|
|
158 /* Define the macros to access a single-int bitmap of descriptors. */
|
|
159 # define FD_SET(n, p) (*(p) |= (1 << (n)))
|
|
160 # define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
|
|
161 # define FD_ISSET(n, p) (*(p) & (1 << (n)))
|
|
162 # define FD_ZERO(p) (*(p) = 0)
|
|
163
|
|
164 #endif /* no FD_SET */
|
|
165
|
|
166 int poll_fds_for_input (SELECT_TYPE mask);
|
|
167
|
440
|
168 #endif /* INCLUDED_sysproc_h_ */
|