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