1 /*
2 Copyright (c) 1982, 1986, 1993
3 The Regents of the University of California.  All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
8 1. Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 3. Neither the name of the University nor the names of its contributors
14 may be used to endorse or promote products derived from this software
15 without specific prior written permission.
16 
17 THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 SUCH DAMAGE.
28  */
29 /* unified sys/types.h:
30    start with sef's sysvi386 version.
31    merge go32 version -- a few ifdefs.
32    h8300hms, h8300xray, and sysvnecv70 disagree on the following types:
33 
34    typedef int gid_t;
35    typedef int uid_t;
36    typedef int dev_t;
37    typedef int ino_t;
38    typedef int mode_t;
39    typedef int caddr_t;
40 
41    however, these aren't "reasonable" values, the sysvi386 ones make far
42    more sense, and should work sufficiently well (in particular, h8300
43    doesn't have a stat, and the necv70 doesn't matter.) -- eichin
44  */
45 
46 #ifndef _SYS_TYPES_H
47 
48 #include <_ansi.h>
49 #include <sys/cdefs.h>
50 #include <machine/_types.h>
51 
52 /* BSD types permitted by POSIX and always exposed as in Glibc.  Only provided
53    for backward compatibility with BSD code.  The uintN_t standard types should
54    be preferred in new code. */
55 #if ___int8_t_defined
56 typedef __uint8_t	u_int8_t;
57 #endif
58 #if ___int16_t_defined
59 typedef __uint16_t	u_int16_t;
60 #endif
61 #if ___int32_t_defined
62 typedef __uint32_t	u_int32_t;
63 #endif
64 #if ___int64_t_defined
65 typedef __uint64_t	u_int64_t;
66 #endif
67 typedef __intptr_t register_t;
68 #define __BIT_TYPES_DEFINED__ 1
69 
70 #ifndef __need_inttypes
71 
72 #define _SYS_TYPES_H
73 #include <sys/_types.h>
74 #include <sys/_stdint.h>
75 
76 #if __BSD_VISIBLE
77 #include <machine/endian.h>
78 #  define	physadr		physadr_t
79 #  define	quad		quad_t
80 
81 #ifndef _IN_ADDR_T_DECLARED
82 typedef	__uint32_t	in_addr_t;	/* base type for internet address */
83 #define	_IN_ADDR_T_DECLARED
84 #endif
85 
86 #ifndef _IN_PORT_T_DECLARED
87 typedef	__uint16_t	in_port_t;
88 #define	_IN_PORT_T_DECLARED
89 #endif
90 
91 typedef	__uintptr_t	u_register_t;
92 #endif /* __BSD_VISIBLE */
93 
94 #if __MISC_VISIBLE
95 #ifndef _BSDTYPES_DEFINED
96 /* also defined in mingw/gmon.h and in w32api/winsock[2].h */
97 #ifndef __u_char_defined
98 typedef	unsigned char	u_char;
99 #define __u_char_defined
100 #endif
101 #ifndef __u_short_defined
102 typedef	unsigned short	u_short;
103 #define __u_short_defined
104 #endif
105 #ifndef __u_int_defined
106 typedef	unsigned int	u_int;
107 #define __u_int_defined
108 #endif
109 #ifndef __u_long_defined
110 typedef	unsigned long	u_long;
111 #define __u_long_defined
112 #endif
113 #define _BSDTYPES_DEFINED
114 #endif
115 #endif /* __MISC_VISIBLE */
116 
117 #if __MISC_VISIBLE
118 typedef	unsigned short	ushort;		/* System V compatibility */
119 typedef	unsigned int	uint;		/* System V compatibility */
120 typedef	unsigned long	ulong;		/* System V compatibility */
121 #endif
122 
123 #ifndef _BLKCNT_T_DECLARED
124 typedef	__blkcnt_t	blkcnt_t;
125 #define	_BLKCNT_T_DECLARED
126 #endif
127 
128 #ifndef _BLKSIZE_T_DECLARED
129 typedef	__blksize_t	blksize_t;
130 #define	_BLKSIZE_T_DECLARED
131 #endif
132 
133 #if !defined(__clock_t_defined) && !defined(_CLOCK_T_DECLARED)
134 typedef	_CLOCK_T_	clock_t;
135 #define	__clock_t_defined
136 #define	_CLOCK_T_DECLARED
137 #endif
138 
139 #if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED)
140 typedef	_TIME_T_	time_t;
141 #define	__time_t_defined
142 #define	_TIME_T_DECLARED
143 #endif
144 
145 typedef	__daddr_t	daddr_t;
146 
147 #ifndef __caddr_t_defined
148 typedef	char *	caddr_t;
149 #define __caddr_t_defined
150 #endif
151 
152 #ifndef _FSBLKCNT_T_DECLARED		/* for statvfs() */
153 typedef	__fsblkcnt_t	fsblkcnt_t;
154 typedef	__fsfilcnt_t	fsfilcnt_t;
155 #define	_FSBLKCNT_T_DECLARED
156 #endif
157 
158 #ifndef _ID_T_DECLARED
159 typedef	__id_t		id_t;		/* can hold a uid_t or pid_t */
160 #define	_ID_T_DECLARED
161 #endif
162 
163 #ifndef _INO_T_DECLARED
164 typedef	__ino_t		ino_t;		/* inode number */
165 #define	_INO_T_DECLARED
166 #endif
167 
168 #if defined(__i386__) && (defined(GO32) || defined(__MSDOS__))
169 typedef	char *		addr_t;
170 typedef unsigned long vm_offset_t;
171 typedef unsigned long vm_size_t;
172 #endif /* __i386__ && (GO32 || __MSDOS__) */
173 
174 /*
175  * All these should be machine specific - right now they are all broken.
176  * However, for all of Cygnus' embedded targets, we want them to all be
177  * the same.  Otherwise things like sizeof (struct stat) might depend on
178  * how the file was compiled (e.g. -mint16 vs -mint32, etc.).
179  */
180 
181 #ifndef _OFF_T_DECLARED
182 typedef	__off_t		off_t;		/* file offset */
183 #define	_OFF_T_DECLARED
184 #endif
185 #ifndef _DEV_T_DECLARED
186 typedef	__dev_t		dev_t;		/* device number or struct cdev */
187 #define	_DEV_T_DECLARED
188 #endif
189 #ifndef _UID_T_DECLARED
190 typedef	__uid_t		uid_t;		/* user id */
191 #define	_UID_T_DECLARED
192 #endif
193 #ifndef _GID_T_DECLARED
194 typedef	__gid_t		gid_t;		/* group id */
195 #define	_GID_T_DECLARED
196 #endif
197 
198 #ifndef _PID_T_DECLARED
199 typedef	__pid_t		pid_t;		/* process id */
200 #define	_PID_T_DECLARED
201 #endif
202 
203 #ifndef _KEY_T_DECLARED
204 typedef	__key_t		key_t;		/* IPC key */
205 #define	_KEY_T_DECLARED
206 #endif
207 
208 #ifndef _SSIZE_T_DECLARED
209 typedef _ssize_t ssize_t;
210 #define	_SSIZE_T_DECLARED
211 #endif
212 
213 #ifndef _MODE_T_DECLARED
214 typedef	__mode_t	mode_t;		/* permissions */
215 #define	_MODE_T_DECLARED
216 #endif
217 
218 #ifndef _NLINK_T_DECLARED
219 typedef	__nlink_t	nlink_t;	/* link count */
220 #define	_NLINK_T_DECLARED
221 #endif
222 
223 #if !defined(__clockid_t_defined) && !defined(_CLOCKID_T_DECLARED)
224 typedef	__clockid_t	clockid_t;
225 #define	__clockid_t_defined
226 #define	_CLOCKID_T_DECLARED
227 #endif
228 
229 #if !defined(__timer_t_defined) && !defined(_TIMER_T_DECLARED)
230 typedef	__timer_t	timer_t;
231 #define	__timer_t_defined
232 #define	_TIMER_T_DECLARED
233 #endif
234 
235 #ifndef _USECONDS_T_DECLARED
236 typedef	__useconds_t	useconds_t;	/* microseconds (unsigned) */
237 #define	_USECONDS_T_DECLARED
238 #endif
239 
240 #ifndef _SUSECONDS_T_DECLARED
241 typedef	__suseconds_t	suseconds_t;
242 #define	_SUSECONDS_T_DECLARED
243 #endif
244 
245 typedef	__int64_t	sbintime_t;
246 
247 #include <sys/features.h>
248 #include <machine/types.h>
249 
250 #endif  /* !__need_inttypes */
251 
252 #undef __need_inttypes
253 
254 #include <stdint.h>
255 #define __Long int32_t
256 #define __ULong uint32_t
257 
258 #endif	/* _SYS_TYPES_H */
259