Subversion Repositories SvarDOS

Rev

Rev 616 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
207 mateuszvis 1
/*!\file sys/wtypes.h
2
 * Watt-32 type definitions.
3
 */
4
 
5
/*-
6
 * Copyright (c) 1982, 1986, 1991 The Regents of the University of California.
7
 * All rights reserved.
8
 *
9
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions
11
 * are met:
12
 * 1. Redistributions of source code must retain the above copyright
13
 *    notice, this list of conditions and the following disclaimer.
14
 * 2. Redistributions in binary form must reproduce the above copyright
15
 *    notice, this list of conditions and the following disclaimer in the
16
 *    documentation and/or other materials provided with the distribution.
17
 * 3. All advertising materials mentioning features or use of this software
18
 *    must display the following acknowledgement:
19
 *	This product includes software developed by the University of
20
 *	California, Berkeley and its contributors.
21
 * 4. Neither the name of the University nor the names of its contributors
22
 *    may be used to endorse or promote products derived from this software
23
 *    without specific prior written permission.
24
 *
25
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35
 * SUCH DAMAGE.
36
 *
37
 *	@(#)types.h	7.17 (Berkeley) 5/6/91
38
 *      @(#)wtypes.h    Waterloo TCP/IP
39
 */
40
 
41
/*
42
 * the naming <sys/wtypes.h> is required for those compilers that
43
 * have <sys/types.h> in the usual place but doesn't define
44
 * the following types. This file is included from <sys/socket.h>,
45
 * <tcp.h> etc.
46
 */
47
 
48
#ifndef __SYS_WTYPES_H
49
#define __SYS_WTYPES_H
50
 
51
#if 0                     /* No, that causes trouble */
52
  #undef  FD_SETSIZE
53
  #define FD_SETSIZE 512  /* use same FD_SETSIZE for all targets */
54
#endif
55
 
56
#if defined(__DJGPP__) || defined(__DMC__) || defined(__MINGW32__) || defined(__POCC__)
57
  #include <sys/types.h>
58
#endif
59
 
60
#if defined(__DJGPP__)
61
  #include <machine/endian.h>
62
#endif
63
 
64
#if defined(__MINGW32__) || (defined(__DJGPP__) && DJGPP_MINOR >= 4) || \
65
    (defined(__WATCOMC__) && __WATCOMC__ >= 1230) ||  /* OW 1.3+ */     \
66
    defined(__POCC__)                                 /* PellesC */
67
  #undef  HAVE_STDINT_H
68
  #define HAVE_STDINT_H
69
  #include <stdint.h>   /* doesn't define 'u_char' etc. */
70
#endif
71
 
72
 
73
#if !defined(HAVE_U_INT64_T) && !defined(u_int64_t)
74
  #if defined(__HIGHC__) || defined(__GNUC__)
75
    typedef unsigned long long  u_int64_t;
76
    #define HAVE_U_INT64_T
77
 
78
  #elif defined(__DMC__) && (__INTSIZE == 4)
79
    typedef unsigned long long  u_int64_t;
80
    #define HAVE_U_INT64_T
81
 
82
  #elif defined(__WATCOMC__) && defined(__WATCOM_INT64__)
83
    typedef unsigned __int64  u_int64_t;
84
    #define HAVE_U_INT64_T
85
 
86
  #elif (defined(_MSC_VER) && (_MSC_VER >= 900)) || defined(__POCC__)
87
    typedef unsigned __int64  u_int64_t;
88
    #define HAVE_U_INT64_T
89
  #endif
90
#endif
91
 
92
#if !defined(__GLIBC__)
93
  #if !defined(HAVE_U_CHAR) && !defined(u_char)
94
    typedef unsigned char  u_char;
95
    #define HAVE_U_CHAR
96
  #endif
97
 
98
  #if !defined(HAVE_U_SHORT) && !defined(u_short)
99
    typedef unsigned short  u_short;
100
    #define HAVE_U_SHORT
101
  #endif
102
 
103
  #if !defined(HAVE_USHORT) && !defined(ushort)
104
    typedef unsigned short  ushort;   /* SysV compatibility */
105
    #define HAVE_USHORT
106
  #endif
107
 
108
  #if !defined(HAVE_U_LONG) && !defined(u_long)
109
    typedef unsigned long  u_long;
110
    #define HAVE_U_LONG
111
  #endif
112
 
113
  #if !defined(HAVE_U_INT) && !defined(u_int)
114
    #if defined(__SMALL__) || defined(__LARGE__)
115
      typedef unsigned long u_int;  /* too many headers assumes u_int is >=32-bit */
116
    #else
117
      typedef unsigned int  u_int;
118
    #endif
119
    #define HAVE_U_INT
120
  #endif
121
 
122
  #if !defined(HAVE_CADDR_T) && !defined(caddr_t)
123
    typedef unsigned long  caddr_t;
124
    #define HAVE_CADDR_T
125
  #endif
126
#endif
127
 
128
#if !defined(HAVE_U_INT8_T) && !defined(u_int8_t)
129
  typedef unsigned char  u_int8_t;
130
#endif
131
 
132
#if !defined(HAVE_U_INT16_T) && !defined(u_int16_t)
133
  typedef unsigned short  u_int16_t;
134
#endif
135
 
136
#if !defined(HAVE_U_INT32_T) && !defined(u_int32_t)
137
  typedef unsigned long  u_int32_t;
138
#endif
139
 
140
#if !defined(HAVE_STDINT_H)
141
  #if !defined(HAVE_INT16_T) && !defined(int16_t)
142
    typedef short  int16_t;
143
    #define HAVE_INT16_T
144
  #endif
145
 
146
  #if !defined(HAVE_INT32_T) && !defined(int32_t)
147
    typedef long  int32_t;
148
    #define HAVE_INT32_T
149
  #endif
150
#endif
151
 
152
#if !defined(HAVE_U_QUAD_T) && !defined(u_quad_t)
153
  #define HAVE_U_QUAD_T
154
  #ifdef HAVE_U_INT64_T
155
    #define u_quad_t  u_int64_t
156
  #else
157
    #define u_quad_t  unsigned long
158
  #endif
159
#endif
160
 
161
#if !defined(IOVEC_DEFINED)
162
  #define IOVEC_DEFINED
163
  struct iovec {
164
         void *iov_base;
165
         int   iov_len;
166
       };
167
#endif
168
 
169
 
170
#define __BIT_TYPES_DEFINED__
171
 
172
#if !defined(FD_SET)  /* not djgpp */
173
 
174
  #undef  FD_SETSIZE
175
  #define FD_SETSIZE    512
176
  #define FD_SET(n, p)  ((p)->fd_bits[(n)/8] |=  (1 << ((n) & 7)))
177
  #define FD_CLR(n, p)  ((p)->fd_bits[(n)/8] &= ~(1 << ((n) & 7)))
178
  #define FD_ISSET(n,p) ((p)->fd_bits[(n)/8] &   (1 << ((n) & 7)))
179
  #define FD_ZERO(p)    memset ((void*)(p), 0, sizeof(*(p)))
180
 
181
  typedef struct fd_set {
182
          unsigned char fd_bits [(FD_SETSIZE+7)/8];
183
        } fd_set;
184
#endif
185
 
186
#ifndef LITTLE_ENDIAN
187
#define LITTLE_ENDIAN 1234
188
#endif
189
 
190
#ifndef BIG_ENDIAN
191
#define BIG_ENDIAN    4321
192
#endif
193
 
194
#if defined(BIG_ENDIAN_MACHINE) || defined(USE_BIGENDIAN)
195
  #define BYTE_ORDER  BIG_ENDIAN
196
#else
197
  #define BYTE_ORDER  LITTLE_ENDIAN
198
#endif
199
 
200
#endif