2 * $XConsortium: Xos.h /main/70 1996/11/15 16:00:41 kaleb $
3 * $XFree86: xc/include/Xos.h,v 3.21.2.1 1998/01/23 12:35:11 dawes Exp $
6 Copyright (c) 1987 X Consortium
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 Except as contained in this notice, the name of the X Consortium shall not be
26 used in advertising or otherwise to promote the sale, use or other dealings
27 in this Software without prior written authorization from the X Consortium.
29 * The X Window System is a Trademark of X Consortium.
33 /* This is a collection of things to try and minimize system dependencies
34 * in a "signficant" number of source files.
40 #include <X11/Xosdefs.h>
43 * Get major data types (esp. caddr_t)
51 #include <sys/types.h> /* forgot to protect it... */
53 #endif /* __TYPES__ */
55 #if defined(_POSIX_SOURCE) && (defined(MOTOROLA) || defined(AMOEBA))
57 #include <sys/types.h>
60 #include <sys/types.h>
66 * Just about everyone needs the strings routines. We provide both forms here,
67 * index/rindex and strchr/strrchr, so any systems that don't provide them all
68 * need to have #defines here.
70 * NOTE: The following ISN'T true for this XFree86 version of this file.
72 * These macros are defined this way, rather than, e.g.:
73 * #defined index(s,c) strchr(s,c)
74 * because someone might be using them as function pointers, and such
75 * a change would break compatibility for anyone who's relying on them
76 * being the way they currently are. So we're stuck with them this way,
77 * which can be really inconvenient. :-(
80 #ifndef X_NOT_STDC_ENV
85 #define index(s,c) (strchr((s),(c)))
88 #define rindex(s,c) (strrchr((s),(c)))
95 #define rindex strrchr
102 #if defined(clipper) || defined(__clipper__)
107 #define rindex strrchr
111 #define strrchr rindex
114 #endif /* X_NOT_STDC_ENV */
119 #if (defined(X_NOT_STDC_ENV) || (defined(sun) && !defined(SVR4)) || defined(macII)) && !defined(__GLIBC__)
121 extern char *sys_errlist[];
123 #define strerror(n) \
124 (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error")
129 * Get open(2) constants
133 #if defined(USL) || defined(CRAY) || defined(MOTOROLA) || (defined(i386) && (defined(SYSV) || defined(SVR4))) || defined(__sxg__)
137 #include <X11/Xw32defs.h>
139 #include <sys/file.h>
141 #else /* X_NOT_POSIX */
142 #if !defined(_POSIX_SOURCE) && defined(macII)
143 #define _POSIX_SOURCE
151 #endif /* X_NOT_POSIX else */
156 #endif /* CSRG_BASED */
165 #include <sys/time.h>
171 #if defined(USG) && !defined(CRAY) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__) && !defined(clipper) && !defined(__clipper__)
181 #endif /* USL_SHARELIB */
189 #endif /* _SEQUENT_ */
193 #if defined(_ANSI_SOURCE) && defined(__bsdi__)
195 #include <sys/time.h>
199 #if defined(_POSIX_SOURCE) && defined(SVR4)
200 /* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */
202 #include <sys/time.h>
203 #define _POSIX_SOURCE
204 #else /* defined(_POSIX_SOURCE) && defined(SVR4) */
207 #if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_)
209 long tv_sec; /* seconds */
210 long tv_usec; /* and microseconds */
213 #include <sys/timeb.h>
214 #define gettimeofday(t) \
216 struct _timeb _gtodtmp; \
217 _ftime (&_gtodtmp); \
218 (t)->tv_sec = _gtodtmp.time; \
219 (t)->tv_usec = _gtodtmp.millitm * 1000; \
224 #else /* _SEQUENT_ */
227 #include <sys/time.h>
233 #include <sys/time.h>
239 #endif /* _SEQUENT_ */
240 #endif /* WIN32 else */
241 #endif /* defined(_POSIX_SOURCE) && defined(SVR4) */
245 /* define X_GETTIMEOFDAY macro, a portable gettimeofday() */
246 #if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */
247 #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
249 #if defined(SVR4) || defined(VMS) || defined(WIN32)
250 #define X_GETTIMEOFDAY(t) gettimeofday(t)
252 #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
254 #endif /* XPG4 else */
258 #include <net/gen/in.h>
259 #include <net/gen/socket.h>
260 #include <net/gen/udp.h>
261 #include <net/gen/udp_hdr.h>
285 typedef char *caddr_t;
286 typedef unsigned char u_char;
290 typedef unsigned long fd_mask;
293 /* use POSIX name for signal */
294 #if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD) && !defined(ISC)
295 #define SIGCHLD SIGCLD
299 #include <sys/bsdtypes.h>
300 #include <sys/limits.h>
304 #if defined(ISC) || defined(__EMX__)
306 * Some OS's may not have this
309 #define X_NO_SYS_UN 1