xref: /xnu-12377.81.4/bsd/sys/_types.h (revision 043036a2b3718f7f0be807e2870f8f47d3fa0796)
1*043036a2SApple OSS Distributions /*
2*043036a2SApple OSS Distributions  * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
3*043036a2SApple OSS Distributions  *
4*043036a2SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*043036a2SApple OSS Distributions  *
6*043036a2SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*043036a2SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*043036a2SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*043036a2SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*043036a2SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*043036a2SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*043036a2SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*043036a2SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*043036a2SApple OSS Distributions  *
15*043036a2SApple OSS Distributions  * Please obtain a copy of the License at
16*043036a2SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*043036a2SApple OSS Distributions  *
18*043036a2SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*043036a2SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*043036a2SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*043036a2SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*043036a2SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*043036a2SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*043036a2SApple OSS Distributions  * limitations under the License.
25*043036a2SApple OSS Distributions  *
26*043036a2SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*043036a2SApple OSS Distributions  */
28*043036a2SApple OSS Distributions 
29*043036a2SApple OSS Distributions #ifndef _SYS__TYPES_H_
30*043036a2SApple OSS Distributions #define _SYS__TYPES_H_
31*043036a2SApple OSS Distributions 
32*043036a2SApple OSS Distributions #include <sys/cdefs.h>
33*043036a2SApple OSS Distributions #include <machine/_types.h>
34*043036a2SApple OSS Distributions 
35*043036a2SApple OSS Distributions #if defined(KERNEL)
36*043036a2SApple OSS Distributions #ifdef XNU_KERNEL_PRIVATE
37*043036a2SApple OSS Distributions /*
38*043036a2SApple OSS Distributions  * Xcode doesn't currently set up search paths correctly for Kernel extensions,
39*043036a2SApple OSS Distributions  * so the clang headers are not seen in the correct order to use their types.
40*043036a2SApple OSS Distributions  */
41*043036a2SApple OSS Distributions #endif
42*043036a2SApple OSS Distributions #define USE_CLANG_TYPES 0
43*043036a2SApple OSS Distributions #else
44*043036a2SApple OSS Distributions #if defined(__has_feature) && __has_feature(modules)
45*043036a2SApple OSS Distributions #define USE_CLANG_TYPES 1
46*043036a2SApple OSS Distributions #else
47*043036a2SApple OSS Distributions #define USE_CLANG_TYPES 0
48*043036a2SApple OSS Distributions #endif
49*043036a2SApple OSS Distributions #endif
50*043036a2SApple OSS Distributions 
51*043036a2SApple OSS Distributions #if USE_CLANG_TYPES
52*043036a2SApple OSS Distributions #include <sys/_types/_null.h>
53*043036a2SApple OSS Distributions #endif
54*043036a2SApple OSS Distributions 
55*043036a2SApple OSS Distributions /*
56*043036a2SApple OSS Distributions  * Type definitions; takes common type definitions that must be used
57*043036a2SApple OSS Distributions  * in multiple header files due to [XSI], removes them from the system
58*043036a2SApple OSS Distributions  * space, and puts them in the implementation space.
59*043036a2SApple OSS Distributions  */
60*043036a2SApple OSS Distributions 
61*043036a2SApple OSS Distributions #if USE_CLANG_TYPES
62*043036a2SApple OSS Distributions #define __DARWIN_NULL NULL
63*043036a2SApple OSS Distributions #elif defined(__cplusplus)
64*043036a2SApple OSS Distributions #ifdef __GNUG__
65*043036a2SApple OSS Distributions #define __DARWIN_NULL __null
66*043036a2SApple OSS Distributions #else /* ! __GNUG__ */
67*043036a2SApple OSS Distributions #ifdef __LP64__
68*043036a2SApple OSS Distributions #define __DARWIN_NULL (0L)
69*043036a2SApple OSS Distributions #else /* !__LP64__ */
70*043036a2SApple OSS Distributions #define __DARWIN_NULL 0
71*043036a2SApple OSS Distributions #endif /* __LP64__ */
72*043036a2SApple OSS Distributions #endif /* __GNUG__ */
73*043036a2SApple OSS Distributions #else /* ! __cplusplus */
74*043036a2SApple OSS Distributions #define __DARWIN_NULL ((void *)0)
75*043036a2SApple OSS Distributions #endif
76*043036a2SApple OSS Distributions 
77*043036a2SApple OSS Distributions #if !defined(DRIVERKIT)
78*043036a2SApple OSS Distributions typedef __int64_t       __darwin_blkcnt_t;      /* total blocks */
79*043036a2SApple OSS Distributions typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
80*043036a2SApple OSS Distributions typedef __int32_t       __darwin_dev_t;         /* dev_t */
81*043036a2SApple OSS Distributions typedef unsigned int    __darwin_fsblkcnt_t;    /* Used by statvfs and fstatvfs */
82*043036a2SApple OSS Distributions typedef unsigned int    __darwin_fsfilcnt_t;    /* Used by statvfs and fstatvfs */
83*043036a2SApple OSS Distributions typedef __uint32_t      __darwin_gid_t;         /* [???] process and group IDs */
84*043036a2SApple OSS Distributions typedef __uint32_t      __darwin_id_t;          /* [XSI] pid_t, uid_t, or gid_t*/
85*043036a2SApple OSS Distributions typedef __uint64_t      __darwin_ino64_t;       /* [???] Used for 64 bit inodes */
86*043036a2SApple OSS Distributions #if __DARWIN_64_BIT_INO_T
87*043036a2SApple OSS Distributions typedef __darwin_ino64_t __darwin_ino_t;        /* [???] Used for inodes */
88*043036a2SApple OSS Distributions #else /* !__DARWIN_64_BIT_INO_T */
89*043036a2SApple OSS Distributions typedef __uint32_t      __darwin_ino_t;         /* [???] Used for inodes */
90*043036a2SApple OSS Distributions #endif /* __DARWIN_64_BIT_INO_T */
91*043036a2SApple OSS Distributions typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
92*043036a2SApple OSS Distributions typedef __darwin_mach_port_name_t __darwin_mach_port_t; /* Used by mach */
93*043036a2SApple OSS Distributions typedef __uint16_t      __darwin_mode_t;        /* [???] Some file attributes */
94*043036a2SApple OSS Distributions typedef __int64_t       __darwin_off_t;         /* [???] Used for file sizes */
95*043036a2SApple OSS Distributions typedef __int32_t       __darwin_pid_t;         /* [???] process and group IDs */
96*043036a2SApple OSS Distributions typedef __uint32_t      __darwin_sigset_t;      /* [???] signal set */
97*043036a2SApple OSS Distributions typedef __int32_t       __darwin_suseconds_t;   /* [???] microseconds */
98*043036a2SApple OSS Distributions typedef __uint32_t      __darwin_uid_t;         /* [???] user IDs */
99*043036a2SApple OSS Distributions typedef __uint32_t      __darwin_useconds_t;    /* [???] microseconds */
100*043036a2SApple OSS Distributions #endif /* !defined(DRIVERKIT) */
101*043036a2SApple OSS Distributions typedef unsigned char   __darwin_uuid_t[16];
102*043036a2SApple OSS Distributions typedef char    __darwin_uuid_string_t[37];
103*043036a2SApple OSS Distributions 
104*043036a2SApple OSS Distributions #undef USE_CLANG_TYPES
105*043036a2SApple OSS Distributions 
106*043036a2SApple OSS Distributions #if !defined(KERNEL) && !defined(DRIVERKIT)
107*043036a2SApple OSS Distributions #include <sys/_pthread/_pthread_types.h>
108*043036a2SApple OSS Distributions #endif /* !defined(KERNEL) && !defined(DRIVERKIT) */
109*043036a2SApple OSS Distributions 
110*043036a2SApple OSS Distributions #if defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 5 || __GNUC__ > 3)
111*043036a2SApple OSS Distributions #define __offsetof(type, field) __builtin_offsetof(type, field)
112*043036a2SApple OSS Distributions #else /* !(gcc >= 3.5) */
113*043036a2SApple OSS Distributions #define __offsetof(type, field) ((size_t)(&((type *)0)->field))
114*043036a2SApple OSS Distributions #endif /* (gcc >= 3.5) */
115*043036a2SApple OSS Distributions 
116*043036a2SApple OSS Distributions #ifdef KERNEL
117*043036a2SApple OSS Distributions #include <sys/_types/_offsetof.h>
118*043036a2SApple OSS Distributions #endif /* KERNEL */
119*043036a2SApple OSS Distributions 
120*043036a2SApple OSS Distributions #endif  /* _SYS__TYPES_H_ */
121