XEmacs 21.2.28 "Hermes".
[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 WINDOWSNT
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 # include <sys/socket.h>
41 # include <netdb.h>
42 # include <netinet/in.h>
43 # include <arpa/inet.h>
44 #ifdef NEED_NET_ERRNO_H
45 #include <net/errno.h>
46 #endif /* NEED_NET_ERRNO_H */
47 #elif defined (SKTPAIR)
48 # include <sys/socket.h>
49 #endif /* HAVE_SOCKETS */
50
51 /* On some systems, e.g. DGUX, inet_addr returns a 'struct in_addr'. */
52 #ifdef HAVE_BROKEN_INET_ADDR
53 # define IN_ADDR struct in_addr
54 # define NUMERIC_ADDR_ERROR (numeric_addr.s_addr == -1)
55 #else
56 # if (LONGBITS > 32)
57 #  define IN_ADDR unsigned int
58 # else
59 #  define IN_ADDR unsigned long
60 # endif
61 # define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) -1)
62 #endif
63
64 /* Define first descriptor number available for subprocesses.  */
65 #define FIRST_PROC_DESC 3
66
67 #ifdef IRIS
68 # include <sys/sysmacros.h>     /* for "minor" */
69 #endif /* not IRIS */
70
71 #endif /* !NO_SUBPROCESSES */
72
73 #ifdef AIX
74 #include <sys/select.h>
75 #endif
76
77 #ifdef FD_SET
78
79 /* We could get this from param.h, but better not to depend on finding that.
80    And better not to risk that it might define other symbols used in this
81    file.  */
82 # ifdef FD_SETSIZE
83 #  define MAXDESC FD_SETSIZE
84 # else
85 #  define MAXDESC 64
86 # endif /* FD_SETSIZE */
87 # define SELECT_TYPE fd_set
88
89 #else /* no FD_SET */
90
91 # define MAXDESC 32
92 # define SELECT_TYPE int
93
94 /* Define the macros to access a single-int bitmap of descriptors.  */
95 # define FD_SET(n, p) (*(p) |= (1 << (n)))
96 # define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
97 # define FD_ISSET(n, p) (*(p) & (1 << (n)))
98 # define FD_ZERO(p) (*(p) = 0)
99
100 #endif /* no FD_SET */
101
102 int poll_fds_for_input (SELECT_TYPE mask);
103
104 #ifdef MSDOS
105 /* #include <process.h> */
106 /* Damn that local process.h!  Instead we can define P_WAIT ourselves.  */
107 #define P_WAIT 1
108 #endif
109
110 #endif /* INCLUDED_sysproc_h_ */