annotate src/sysproc.h @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 3ecd8885ac67
children abe6d1db359e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1995 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 /* Synched up with: Not really in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
23 #ifndef INCLUDED_sysproc_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
24 #define INCLUDED_sysproc_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
25
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 #ifdef HAVE_VFORK_H
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 # include <vfork.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include "systime.h" /* necessary for sys/resource.h; also gets the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 FD_* defines on some systems. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #ifndef WINDOWSNT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <sys/resource.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #if !defined (NO_SUBPROCESSES)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 # include <sys/types.h> /* AJK */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 # include <sys/socket.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 # include <netdb.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 # include <netinet/in.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 # include <arpa/inet.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 #ifdef NEED_NET_ERRNO_H
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 #include <net/errno.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 #endif /* NEED_NET_ERRNO_H */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 #elif defined (SKTPAIR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 # include <sys/socket.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 #endif /* HAVE_SOCKETS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 /* On some systems, e.g. DGUX, inet_addr returns a 'struct in_addr'. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 #ifdef HAVE_BROKEN_INET_ADDR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 # define IN_ADDR struct in_addr
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 # define NUMERIC_ADDR_ERROR (numeric_addr.s_addr == -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 # if (LONGBITS > 32)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 # define IN_ADDR unsigned int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 # define IN_ADDR unsigned long
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 # define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 /* Define first descriptor number available for subprocesses. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 #define FIRST_PROC_DESC 3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 #ifdef IRIS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 # include <sys/sysmacros.h> /* for "minor" */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 #endif /* not IRIS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 #endif /* !NO_SUBPROCESSES */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 #ifdef AIX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 #include <sys/select.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 #ifdef FD_SET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 /* We could get this from param.h, but better not to depend on finding that.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 And better not to risk that it might define other symbols used in this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 file. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 # ifdef FD_SETSIZE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 # define MAXDESC FD_SETSIZE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 # define MAXDESC 64
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 # endif /* FD_SETSIZE */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 # define SELECT_TYPE fd_set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 #else /* no FD_SET */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 # define MAXDESC 32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 # define SELECT_TYPE int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 /* Define the macros to access a single-int bitmap of descriptors. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 # define FD_SET(n, p) (*(p) |= (1 << (n)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 # define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 # define FD_ISSET(n, p) (*(p) & (1 << (n)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 # define FD_ZERO(p) (*(p) = 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 #endif /* no FD_SET */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 int poll_fds_for_input (SELECT_TYPE mask);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 #ifdef MSDOS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 /* #include <process.h> */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 /* Damn that local process.h! Instead we can define P_WAIT ourselves. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 #define P_WAIT 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 #endif
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
109
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
110 #endif /* INCLUDED_sysproc_h_ */