xref: /xnu-8796.141.3/libkern/libkern/OSTypes.h (revision 1b191cb58250d0705d8a51287127505aa4bc0789)
1 /*
2  * Copyright (c) 1999-2012 Apple Computer, Inc. All rights reserved.
3  *
4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. The rights granted to you under the License
10  * may not be used to create, or enable the creation or redistribution of,
11  * unlawful or unlicensed copies of an Apple operating system, or to
12  * circumvent, violate, or enable the circumvention or violation of, any
13  * terms of an Apple operating system software license agreement.
14  *
15  * Please obtain a copy of the License at
16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17  *
18  * The Original Code and all software distributed under the License are
19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23  * Please see the License for the specific language governing rights and
24  * limitations under the License.
25  *
26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27  */
28 
29 #if !defined(KERNEL)
30 #include <MacTypes.h>
31 #endif  /* !KERNEL */
32 
33 #ifndef _OS_OSTYPES_H
34 #define _OS_OSTYPES_H
35 
36 #define OSTYPES_K64_REV         2
37 
38 typedef unsigned int       UInt;
39 typedef signed int         SInt;
40 
41 #if defined(KERNEL)
42 
43 typedef unsigned char      UInt8;
44 typedef unsigned short     UInt16;
45 #if __LP64__
46 typedef unsigned int       UInt32;
47 #else
48 typedef unsigned long      UInt32;
49 #endif
50 typedef unsigned long long UInt64;
51 #if             defined(__BIG_ENDIAN__)
52 typedef struct __attribute__((deprecated)) UnsignedWide {
53 	UInt32          hi;
54 	UInt32          lo;
55 }                                                       UnsignedWide __attribute__((deprecated));
56 #elif           defined(__LITTLE_ENDIAN__)
57 typedef struct __attribute__((deprecated)) UnsignedWide {
58 	UInt32          lo;
59 	UInt32          hi;
60 }                                                       UnsignedWide __attribute__((deprecated));
61 #else
62 #error Unknown endianess.
63 #endif
64 
65 typedef signed char        SInt8;
66 typedef signed short       SInt16;
67 #if __LP64__
68 typedef signed int         SInt32;
69 #else
70 typedef signed long        SInt32;
71 #endif
72 typedef signed long long   SInt64;
73 
74 typedef SInt32                          OSStatus;
75 
76 #ifndef ABSOLUTETIME_SCALAR_TYPE
77 #define ABSOLUTETIME_SCALAR_TYPE    1
78 #endif
79 typedef UInt64          AbsoluteTime;
80 
81 typedef UInt32                          OptionBits __attribute__((deprecated));
82 
83 #if defined(__LP64__)
84 /*
85  * Use intrinsic boolean types for the LP64 kernel, otherwise maintain
86  * source and binary backward compatibility.  This attempts to resolve
87  * the "(x == true)" vs. "(x)" conditional issue.
88  */
89 #ifdef __cplusplus
90 typedef bool Boolean;
91 #else   /* !__cplusplus */
92 #if defined(__STDC_VERSION__) && ((__STDC_VERSION__ - 199901L) > 0L)
93 /* only use this if we are sure we are using a c99 compiler */
94 typedef _Bool Boolean;
95 #else   /* !c99 */
96 /* Fall back to previous definition unless c99 */
97 typedef unsigned char Boolean;
98 #endif  /* !c99 */
99 #endif  /* !__cplusplus */
100 #else   /* !__LP64__ */
101 typedef unsigned char Boolean;
102 #endif  /* !__LP64__ */
103 
104 #endif  /* KERNEL */
105 
106 #include <sys/_types/_os_inline.h>
107 
108 #endif /* _OS_OSTYPES_H */
109