Home | History | Annotate | Download | only in X11
      1 /*  DO NOT EDIT THIS FILE.
      2 
      3     It has been auto-edited by fixincludes from:
      4 
      5 	"/usr/include/X11/Xos.h"
      6 
      7     This had to be done to correct non-standard usages in the
      8     original, manufacturer supplied header file.  */
      9 
     10 /*
     11  * $XdotOrg: xc/include/Xos.h,v 1.4 2005/01/03 18:03:49 eich Exp $
     12  * $Xorg: Xos.h,v 1.6 2001/02/09 02:03:22 xorgcvs Exp $
     13  *
     14  *
     15 Copyright 1987, 1998  The Open Group
     16 
     17 Permission to use, copy, modify, distribute, and sell this software and its
     18 documentation for any purpose is hereby granted without fee, provided that
     19 the above copyright notice appear in all copies and that both that
     20 copyright notice and this permission notice appear in supporting
     21 documentation.
     22 
     23 The above copyright notice and this permission notice shall be included in
     24 all copies or substantial portions of the Software.
     25 
     26 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     27 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     28 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     29 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
     30 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     31 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     32 
     33 Except as contained in this notice, the name of The Open Group shall not be
     34 used in advertising or otherwise to promote the sale, use or other dealings
     35 in this Software without prior written authorization from The Open Group.
     36  *
     37  * The X Window System is a Trademark of The Open Group.
     38  *
     39  */
     40 /* $XFree86: xc/include/Xos.h,v 3.41tsi Exp $ */
     41 
     42 /* This is a collection of things to try and minimize system dependencies
     43  * in a "signficant" number of source files.
     44  */
     45 
     46 #ifndef _XOS_H_
     47 #define _XOS_H_
     48 
     49 #include <X11/Xosdefs.h>
     50 
     51 /*
     52  * Get major data types (esp. caddr_t)
     53  */
     54 
     55 #ifdef USG
     56 #ifndef __TYPES__
     57 #ifdef CRAY
     58 #define word word_t
     59 #endif /* CRAY */
     60 #include <sys/types.h>			/* forgot to protect it... */
     61 #define __TYPES__
     62 #endif /* __TYPES__ */
     63 #else /* USG */
     64 #if defined(_POSIX_SOURCE) && defined(MOTOROLA)
     65 #undef _POSIX_SOURCE
     66 #include <sys/types.h>
     67 #define _POSIX_SOURCE
     68 #else
     69 # include <sys/types.h>
     70 #endif
     71 #endif /* USG */
     72 
     73 #ifndef sgi
     74 #if defined(__SCO__) || defined(__UNIXWARE__)
     75 #include <stdint.h>
     76 #endif
     77 #endif
     78 
     79 #ifdef _SEQUENT_
     80 /*
     81  * in_systm.h compatibility between SysV and BSD types u_char u_short u_long
     82  * select.h  for typedef of args to select, fd_set, may use SVR4 later
     83  */
     84 #include <netinet/in_systm.h>
     85 #include <sys/select.h>
     86 #endif /* _SEQUENT_ */
     87 
     88 /*
     89  * Just about everyone needs the strings routines.  We provide both forms here,
     90  * index/rindex and strchr/strrchr, so any systems that don't provide them all
     91  * need to have #defines here.
     92  *
     93  * These macros are defined this way, rather than, e.g.:
     94  *    #defined index(s,c) strchr(s,c)
     95  * because someone might be using them as function pointers, and such
     96  * a change would break compatibility for anyone who's relying on them
     97  * being the way they currently are. So we're stuck with them this way,
     98  * which can be really inconvenient. :-(
     99  */
    100 
    101 #ifndef X_NOT_STDC_ENV
    102 
    103 #include <string.h>
    104 #if defined(__SCO__) || defined(__UNIXWARE__)
    105 #include <strings.h>
    106 #else
    107 #if (defined(sun) && defined(__SVR4))
    108 #include <strings.h>
    109 #endif
    110 #ifdef __STDC__
    111 #ifndef index
    112 #define index(s,c) (strchr((s),(c)))
    113 #endif
    114 #ifndef rindex
    115 #define rindex(s,c) (strrchr((s),(c)))
    116 #endif
    117 #else
    118 #ifndef index
    119 #define index strchr
    120 #endif
    121 #ifndef rindex
    122 #define rindex strrchr
    123 #endif
    124 #endif
    125 #endif
    126 
    127 #else
    128 
    129 #ifdef SYSV
    130 #if defined(clipper) || defined(__clipper__)
    131 #include <malloc.h>
    132 #endif
    133 #include <string.h>
    134 #define index strchr
    135 #define rindex strrchr
    136 #else
    137 #include <strings.h>
    138 #define strchr index
    139 #define strrchr rindex
    140 #endif
    141 
    142 #endif /* X_NOT_STDC_ENV */
    143 
    144 /*
    145  * strerror()
    146  */
    147 #if (defined(X_NOT_STDC_ENV) || (defined(sun) && !defined(SVR4)) || defined(macII)) && !defined(__GLIBC__)
    148 #ifndef strerror
    149 extern char *sys_errlist[];
    150 extern int sys_nerr;
    151 #define strerror(n) \
    152     (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error")
    153 #endif
    154 #endif
    155 
    156 /*
    157  * Get open(2) constants
    158  */
    159 #if defined(X_NOT_POSIX)
    160 #include <fcntl.h>
    161 #if defined(USL) || defined(CRAY) || defined(MOTOROLA) || (defined(__i386__) && (defined(SYSV) || defined(SVR4))) || defined(__sxg__)
    162 #include <unistd.h>
    163 #endif
    164 #ifdef WIN32
    165 #include <X11/Xw32defs.h>
    166 #else
    167 #include <sys/file.h>
    168 #endif
    169 #else /* X_NOT_POSIX */
    170 #if !defined(_POSIX_SOURCE) && defined(macII)
    171 #define _POSIX_SOURCE
    172 #include <fcntl.h>
    173 #include <unistd.h>
    174 #undef _POSIX_SOURCE
    175 #else
    176 #include <fcntl.h>
    177 #include <unistd.h>
    178 #endif
    179 #endif /* X_NOT_POSIX else */
    180 
    181 /*
    182  * Get struct timeval and struct tm
    183  */
    184 
    185 #if defined(SYSV) && !defined(_SEQUENT_)
    186 
    187 #ifndef USL
    188 #include <sys/time.h>
    189 #endif
    190 #include <time.h>
    191 #ifdef CRAY
    192 #undef word
    193 #endif /* CRAY */
    194 #if defined(USG) && !defined(CRAY) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__) && !defined(clipper) && !defined(__clipper__)
    195 struct timeval {
    196     long tv_sec;
    197     long tv_usec;
    198 };
    199 #ifndef USL_SHARELIB
    200 struct timezone {
    201     int tz_minuteswest;
    202     int tz_dsttime;
    203 };
    204 #endif /* USL_SHARELIB */
    205 #endif /* USG */
    206 
    207 #ifdef _SEQUENT_
    208 struct timezone {
    209     int tz_minuteswest;
    210     int tz_dsttime;
    211 };
    212 #endif /* _SEQUENT_ */
    213 
    214 #else /* not SYSV */
    215 
    216 #if defined(_POSIX_SOURCE) && defined(SVR4)
    217 /* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */
    218 #undef _POSIX_SOURCE
    219 #include <sys/time.h>
    220 #define _POSIX_SOURCE
    221 #elif defined(WIN32)
    222 #include <time.h>
    223 #if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_) && !defined(_TIMEVAL_DEFINED) && !defined(_STRUCT_TIMEVAL)
    224 struct timeval {
    225     long    tv_sec;         /* seconds */
    226     long    tv_usec;        /* and microseconds */
    227 };
    228 #define _TIMEVAL_DEFINED
    229 #endif
    230 #include <sys/timeb.h>
    231 #define gettimeofday(t) \
    232 { \
    233     struct _timeb _gtodtmp; \
    234     _ftime (&_gtodtmp); \
    235     (t)->tv_sec = _gtodtmp.time; \
    236     (t)->tv_usec = _gtodtmp.millitm * 1000; \
    237 }
    238 #elif defined(_SEQUENT_) || defined(Lynx)
    239 #include <time.h>
    240 #elif defined (__QNX__)
    241 typedef unsigned long fd_mask;
    242 /* Make sure we get 256 bit select masks */
    243 #define FD_SETSIZE 256
    244 #include <sys/select.h>
    245 #include <sys/time.h>
    246 #include <time.h>
    247 #else
    248 #include <sys/time.h>
    249 #include <time.h>
    250 #endif /* defined(_POSIX_SOURCE) && defined(SVR4) */
    251 
    252 #endif /* SYSV */
    253 
    254 /* define X_GETTIMEOFDAY macro, a portable gettimeofday() */
    255 #if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */
    256 #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
    257 #else
    258 #if defined(SVR4) || defined(VMS) || defined(WIN32)
    259 #define X_GETTIMEOFDAY(t) gettimeofday(t)
    260 #else
    261 #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
    262 #endif
    263 #endif /* XPG4 else */
    264 
    265 #ifdef __UNIXOS2__
    266 typedef unsigned long fd_mask;
    267 #include <limits.h>
    268 #define MAX_PATH _POSIX_PATH_MAX
    269 #endif
    270 
    271 #ifdef __GNU__
    272 #define PATH_MAX 4096
    273 #define MAXPATHLEN 4096
    274 #define OPEN_MAX 256 /* We define a reasonable limit.  */
    275 #endif
    276 
    277 /* use POSIX name for signal */
    278 #if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD) && !defined(ISC)
    279 #define SIGCHLD SIGCLD
    280 #endif
    281 
    282 #ifdef ISC
    283 #include <sys/bsdtypes.h>
    284 #include <sys/limits.h>
    285 #define NGROUPS 16
    286 #endif
    287 
    288 #if defined(ISC) || defined(__UNIXOS2__) || \
    289     (defined(__linux__) && !defined(__GLIBC__)) || \
    290     (defined(__QNX__) && !defined(UNIXCONN))
    291 /*
    292  *	Some OS's may not have this
    293  */
    294 
    295 #define X_NO_SYS_UN 1
    296 
    297 struct sockaddr_un {
    298 	short	sun_family;
    299 	char	sun_path[108];
    300 };
    301 #endif
    302 
    303 #include <X11/Xarch.h>
    304 
    305 #endif /* _XOS_H_ */
    306