]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/sys/types.h
Add device abstraction code for the UEFI Console and UEFI Shell-based file systems.
[mirror_edk2.git] / StdLib / Include / sys / types.h
CommitLineData
2aa62f2b 1/** @file\r
2 System type declarations.\r
3\r
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials are licensed and made available\r
6 under the terms and conditions of the BSD License that accompanies this\r
7 distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php.\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13 Copyright (c) 1990, 1993\r
14 The Regents of the University of California. All rights reserved.\r
15\r
16 Redistribution and use in source and binary forms, with or without\r
17 modification, are permitted provided that the following conditions\r
18 are met:\r
19 - Redistributions of source code must retain the above copyright\r
20 notice, this list of conditions and the following disclaimer.\r
21 - Redistributions in binary form must reproduce the above copyright\r
22 notice, this list of conditions and the following disclaimer in the\r
23 documentation and/or other materials provided with the distribution.\r
24 - Neither the name of the University nor the names of its contributors\r
25 may be used to endorse or promote products derived from this software\r
26 without specific prior written permission.\r
27\r
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
29 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
30 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
31 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE\r
32 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
33 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
34 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
35 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
36 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
37 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
38 POSSIBILITY OF SUCH DAMAGE.\r
39\r
40 NetBSD: types.h,v 1.71.12.1 2007/09/27 13:40:47 xtraeme Exp\r
41 types.h 8.4 (Berkeley) 1/21/94\r
42**/\r
43#ifndef _SYS_TYPES_H_\r
44#define _SYS_TYPES_H_\r
45\r
46#include <sys/EfiCdefs.h>\r
47\r
48/* Machine type dependent parameters. */\r
49#include <machine/types.h>\r
50\r
51#include <machine/ansi.h>\r
52#include <machine/int_types.h>\r
53\r
54\r
55#include <sys/ansi.h>\r
56\r
57#ifndef int8_t\r
58 typedef __int8_t int8_t;\r
59 #define int8_t __int8_t\r
60#endif\r
61\r
62#ifndef uint8_t\r
63 typedef __uint8_t uint8_t;\r
64 #define uint8_t __uint8_t\r
65#endif\r
66\r
67#ifndef int16_t\r
68 typedef __int16_t int16_t;\r
69 #define int16_t __int16_t\r
70#endif\r
71\r
72#ifndef uint16_t\r
73 typedef __uint16_t uint16_t;\r
74 #define uint16_t __uint16_t\r
75#endif\r
76\r
77#ifndef int32_t\r
78 typedef __int32_t int32_t;\r
79 #define int32_t __int32_t\r
80#endif\r
81\r
82#ifndef uint32_t\r
83 typedef __uint32_t uint32_t;\r
84 #define uint32_t __uint32_t\r
85#endif\r
86\r
87#ifndef int64_t\r
88 typedef __int64_t int64_t;\r
89 #define int64_t __int64_t\r
90#endif\r
91\r
92#ifndef uint64_t\r
93 typedef __uint64_t uint64_t;\r
94 #define uint64_t __uint64_t\r
95#endif\r
96\r
97typedef uint8_t u_int8_t;\r
98typedef uint16_t u_int16_t;\r
99typedef uint32_t u_int32_t;\r
100typedef uint64_t u_int64_t;\r
101\r
102#include <machine/endian.h>\r
103\r
104#if defined(_NETBSD_SOURCE)\r
105 typedef UINT8 u_char;\r
106 typedef UINT16 u_short;\r
107 typedef UINTN u_int;\r
108 typedef ULONGN u_long;\r
109\r
110 typedef UINT8 unchar; /* Sys V compatibility */\r
111 typedef UINT16 ushort; /* Sys V compatibility */\r
112 typedef UINTN uint; /* Sys V compatibility */\r
113 typedef ULONGN ulong; /* Sys V compatibility */\r
114\r
115 typedef u_long cpuid_t;\r
116#endif\r
117\r
118typedef uint64_t u_quad_t; /* quads */\r
119typedef int64_t quad_t;\r
120typedef quad_t * qaddr_t;\r
121\r
122/*\r
123 * The types longlong_t and u_longlong_t exist for use with the\r
124 * Sun-derived XDR routines involving these types, and their usage\r
125 * in other contexts is discouraged. Further note that these types\r
126 * may not be equivalent to "long long" and "unsigned long long",\r
127 * they are only guaranteed to be signed and unsigned 64-bit types\r
128 * respectively. Portable programs that need 64-bit types should use\r
129 * the C99 types int64_t and uint64_t instead.\r
130 */\r
131\r
132typedef int64_t longlong_t; /* for XDR */\r
133typedef uint64_t u_longlong_t; /* for XDR */\r
134\r
135typedef int64_t blkcnt_t; /* fs block count */\r
136typedef uint32_t blksize_t; /* fs optimal block size */\r
137\r
138#ifndef fsblkcnt_t\r
139 typedef __fsblkcnt_t fsblkcnt_t; /* fs block count (statvfs) */\r
140 #define fsblkcnt_t __fsblkcnt_t\r
141#endif\r
142\r
143#ifndef fsfilcnt_t\r
144 typedef __fsfilcnt_t fsfilcnt_t; /* fs file count */\r
145 #define fsfilcnt_t __fsfilcnt_t\r
146#endif\r
147\r
148#ifndef caddr_t\r
149 typedef __caddr_t caddr_t; /* core address */\r
150 #define caddr_t __caddr_t\r
151#endif\r
152\r
153#ifdef __daddr_t\r
154 typedef __daddr_t daddr_t; /* disk address */\r
155 #undef __daddr_t\r
156#else\r
157 typedef int64_t daddr_t; /* disk address */\r
158#endif\r
159\r
160typedef uint32_t dev_t; /* device number */\r
161typedef uint32_t fixpt_t; /* fixed point number */\r
162\r
163#ifndef gid_t\r
164 typedef __gid_t gid_t; /* group id */\r
165 #define gid_t __gid_t\r
166#endif\r
167\r
168typedef uint32_t id_t; /* group id, process id or user id */\r
169typedef uint64_t ino_t; /* inode number */\r
170typedef EFI_LONG_T key_t; /* IPC key (for Sys V IPC) */\r
171\r
172#ifndef mode_t\r
173 typedef __mode_t mode_t; /* permissions */\r
174 #define mode_t __mode_t\r
175#endif\r
176\r
177typedef uint32_t nlink_t; /* link count */\r
178\r
179#ifndef off_t\r
180 typedef __off_t off_t; /* file offset */\r
181 #define off_t __off_t\r
182#endif\r
183\r
184#ifndef pid_t\r
185 typedef __pid_t pid_t; /* process id */\r
186 #define pid_t __pid_t\r
187#endif\r
188typedef int32_t lwpid_t; /* LWP id */\r
189typedef quad_t rlim_t; /* resource limit */\r
190typedef int32_t segsz_t; /* segment size */\r
191typedef int32_t swblk_t; /* swap offset */\r
192\r
193#ifndef uid_t\r
194 typedef __uid_t uid_t; /* user id */\r
195 #define uid_t __uid_t\r
196#endif\r
197\r
198typedef int64_t dtime_t; /* on-disk time_t */\r
199\r
200#if defined(_LIBC)\r
201 /*\r
202 * semctl(2)'s argument structure. This is here for the benefit of\r
203 * <sys/syscallargs.h>. It is not in the user's namespace in SUSv2.\r
204 * The SUSv2 semctl(2) takes variable arguments.\r
205 */\r
206 union __semun {\r
207 int val; /* value for SETVAL */\r
208 struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */\r
209 unsigned short *array; /* array for GETALL & SETALL */\r
210 };\r
211 /* For the same reason as above */\r
212 #include <sys/stdint.h>\r
213 typedef intptr_t semid_t;\r
214#endif /* _LIBC */\r
215\r
216/*\r
217 * These belong in EfiSysCall.h, but are also placed here to ensure that\r
218 * long arguments will be promoted to off_t if the program fails to\r
219 * include that header or explicitly cast them to off_t.\r
220 */\r
221#ifndef __OFF_T_SYSCALLS_DECLARED\r
222 #define __OFF_T_SYSCALLS_DECLARED\r
223 __BEGIN_DECLS\r
224 extern off_t lseek (int, off_t, int);\r
225 extern int truncate (const char *, off_t);\r
226 extern int ftruncate (int, off_t);\r
227 __END_DECLS\r
228#endif /* __OFF_T_SYSCALLS_DECLARED */\r
229\r
230#if defined(_NETBSD_SOURCE)\r
231 /* Major, minor numbers, dev_t's. */\r
232 #define major(x) ((int32_t)((((x) & 0x000fff00) >> 8)))\r
233 #define minor(x) ((int32_t)((((x) & 0xfff00000) >> 12) | \\r
234 (((x) & 0x000000ff) >> 0)))\r
235 #define makedev(x,y) ((dev_t)((((x) << 8) & 0x000fff00) | \\r
236 (((y) << 12) & 0xfff00000) | \\r
237 (((y) << 0) & 0x000000ff)))\r
238#endif\r
239\r
240#if defined(_BSD_CLOCK_T_) && defined(_EFI_CLOCK_T)\r
241 typedef _BSD_CLOCK_T_ clock_t;\r
242 #undef _BSD_CLOCK_T_\r
243 #undef _EFI_CLOCK_T\r
244#endif\r
245\r
53e1e5c6 246#ifdef _EFI_SIZE_T_\r
247 typedef _EFI_SIZE_T_ size_t;\r
2aa62f2b 248 #define _SIZE_T\r
249 #undef _BSD_SIZE_T_\r
250 #undef _EFI_SIZE_T_\r
251#endif\r
252\r
253#ifdef _BSD_SSIZE_T_\r
254 typedef _BSD_SSIZE_T_ ssize_t;\r
255 #undef _BSD_SSIZE_T_\r
256#endif\r
257\r
258#if defined(_BSD_TIME_T_) && defined(_EFI_TIME_T)\r
259 typedef _BSD_TIME_T_ time_t;\r
260 #undef _BSD_TIME_T_\r
261 #undef _EFI_TIME_T\r
262#endif\r
263\r
264#ifdef _BSD_CLOCKID_T_\r
265 typedef _BSD_CLOCKID_T_ clockid_t;\r
266 #undef _BSD_CLOCKID_T_\r
267#endif\r
268\r
269#ifdef _BSD_TIMER_T_\r
270 typedef _BSD_TIMER_T_ timer_t;\r
271 #undef _BSD_TIMER_T_\r
272#endif\r
273\r
274#ifdef _BSD_SUSECONDS_T_\r
275 typedef _BSD_SUSECONDS_T_ suseconds_t;\r
276 #undef _BSD_SUSECONDS_T_\r
277#endif\r
278\r
279#ifdef _BSD_USECONDS_T_\r
280 typedef _BSD_USECONDS_T_ useconds_t;\r
281 #undef _BSD_USECONDS_T_\r
282#endif\r
283\r
284#ifdef _NETBSD_SOURCE\r
285 #include <sys/fd_set.h>\r
286 #define NBBY __NBBY\r
287\r
288 typedef struct kauth_cred *kauth_cred_t;\r
289\r
290#endif\r
291\r
292#if 0\r
293 #if !defined(_KERNEL) && !defined(_STANDALONE)\r
294 #if (_POSIX_C_SOURCE - 0L) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \\r
295 defined(_NETBSD_SOURCE)\r
296 #include <pthread_types.h>\r
297 #endif\r
298 #endif\r
299#endif /* if 0 */\r
300\r
301#endif /* !_SYS_TYPES_H_ */\r