XEmacs 21.2.36 "Notos"
[chise/xemacs-chise.git.1] / src / sysproc.h
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
23 #ifndef INCLUDED_sysproc_h_
24 #define INCLUDED_sysproc_h_
25
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. */
32 #ifndef WIN32_NATIVE
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 */
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 */
49 #elif defined (SKTPAIR)
50 # include <sys/socket.h>
51 #endif /* HAVE_SOCKETS */
52
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
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
121 #ifdef HAVE_SYS_STROPTS_H
122 #include <sys/stropts.h>        /* isastream(), I_PUSH */
123 #endif
124
125 #ifdef HAVE_SYS_STRTIO_H
126 #include <sys/strtio.h>         /* TIOCSIGNAL */
127 #endif
128
129 #ifdef HAVE_PTY_H
130 #include <pty.h>                /* openpty() on Tru64, Linux */
131 #endif
132
133 #ifdef HAVE_LIBUTIL_H
134 #include <libutil.h>            /* openpty() on BSD */
135 #endif
136
137 #ifdef FD_SET
138
139 /* We could get this from param.h, but better not to depend on finding that.
140    And better not to risk that it might define other symbols used in this
141    file.  */
142 # ifdef FD_SETSIZE
143 #  define MAXDESC FD_SETSIZE
144 # else
145 #  define MAXDESC 64
146 # endif /* FD_SETSIZE */
147 # define SELECT_TYPE fd_set
148
149 #else /* no FD_SET */
150
151 # define MAXDESC 32
152 # define SELECT_TYPE int
153
154 /* Define the macros to access a single-int bitmap of descriptors.  */
155 # define FD_SET(n, p) (*(p) |= (1 << (n)))
156 # define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
157 # define FD_ISSET(n, p) (*(p) & (1 << (n)))
158 # define FD_ZERO(p) (*(p) = 0)
159
160 #endif /* no FD_SET */
161
162 int poll_fds_for_input (SELECT_TYPE mask);
163
164 #endif /* INCLUDED_sysproc_h_ */