]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/_types.h
xnu-1228.15.4.tar.gz
[apple/xnu.git] / bsd / sys / _types.h
CommitLineData
91447636 1/*
2d21ac55 2 * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
5d5c5d0d 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
91447636 5 *
2d21ac55
A
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.
8f6c56a5 14 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
91447636
A
27 */
28
29#ifndef _SYS__TYPES_H_
30#define _SYS__TYPES_H_
31
32#include <sys/cdefs.h>
33#include <machine/_types.h>
34
91447636
A
35/* pthread opaque structures */
36#if defined(__LP64__)
37#define __PTHREAD_SIZE__ 1168
38#define __PTHREAD_ATTR_SIZE__ 56
39#define __PTHREAD_MUTEXATTR_SIZE__ 8
40#define __PTHREAD_MUTEX_SIZE__ 56
41#define __PTHREAD_CONDATTR_SIZE__ 8
42#define __PTHREAD_COND_SIZE__ 40
43#define __PTHREAD_ONCE_SIZE__ 8
44#define __PTHREAD_RWLOCK_SIZE__ 192
45#define __PTHREAD_RWLOCKATTR_SIZE__ 16
46#else /* __LP64__ */
47#define __PTHREAD_SIZE__ 596
48#define __PTHREAD_ATTR_SIZE__ 36
49#define __PTHREAD_MUTEXATTR_SIZE__ 8
50#define __PTHREAD_MUTEX_SIZE__ 40
51#define __PTHREAD_CONDATTR_SIZE__ 4
52#define __PTHREAD_COND_SIZE__ 24
53#define __PTHREAD_ONCE_SIZE__ 4
54#define __PTHREAD_RWLOCK_SIZE__ 124
55#define __PTHREAD_RWLOCKATTR_SIZE__ 12
56#endif /* __LP64__ */
57
58struct __darwin_pthread_handler_rec
59{
60 void (*__routine)(void *); /* Routine to call */
61 void *__arg; /* Argument to pass */
62 struct __darwin_pthread_handler_rec *__next;
63};
64struct _opaque_pthread_attr_t { long __sig; char __opaque[__PTHREAD_ATTR_SIZE__]; };
65struct _opaque_pthread_cond_t { long __sig; char __opaque[__PTHREAD_COND_SIZE__]; };
66struct _opaque_pthread_condattr_t { long __sig; char __opaque[__PTHREAD_CONDATTR_SIZE__]; };
67struct _opaque_pthread_mutex_t { long __sig; char __opaque[__PTHREAD_MUTEX_SIZE__]; };
68struct _opaque_pthread_mutexattr_t { long __sig; char __opaque[__PTHREAD_MUTEXATTR_SIZE__]; };
69struct _opaque_pthread_once_t { long __sig; char __opaque[__PTHREAD_ONCE_SIZE__]; };
70struct _opaque_pthread_rwlock_t { long __sig; char __opaque[__PTHREAD_RWLOCK_SIZE__]; };
71struct _opaque_pthread_rwlockattr_t { long __sig; char __opaque[__PTHREAD_RWLOCKATTR_SIZE__]; };
72struct _opaque_pthread_t { long __sig; struct __darwin_pthread_handler_rec *__cleanup_stack; char __opaque[__PTHREAD_SIZE__]; };
73
74/*
75 * Type definitions; takes common type definitions that must be used
76 * in multiple header files due to [XSI], removes them from the system
77 * space, and puts them in the implementation space.
78 */
79
80#ifdef __cplusplus
81#ifdef __GNUG__
82#define __DARWIN_NULL __null
83#else /* ! __GNUG__ */
84#ifdef __LP64__
85#define __DARWIN_NULL (0L)
86#else /* !__LP64__ */
87#define __DARWIN_NULL 0
88#endif /* __LP64__ */
89#endif /* __GNUG__ */
90#else /* ! __cplusplus */
91#define __DARWIN_NULL ((void *)0)
92#endif /* __cplusplus */
93
94typedef __int64_t __darwin_blkcnt_t; /* total blocks */
95typedef __int32_t __darwin_blksize_t; /* preferred block size */
96typedef __int32_t __darwin_dev_t; /* dev_t */
97typedef unsigned int __darwin_fsblkcnt_t; /* Used by statvfs and fstatvfs */
98typedef unsigned int __darwin_fsfilcnt_t; /* Used by statvfs and fstatvfs */
99typedef __uint32_t __darwin_gid_t; /* [???] process and group IDs */
100typedef __uint32_t __darwin_id_t; /* [XSI] pid_t, uid_t, or gid_t*/
2d21ac55
A
101typedef __uint64_t __darwin_ino64_t; /* [???] Used for 64 bit inodes */
102#if __DARWIN_64_BIT_INO_T
103typedef __darwin_ino64_t __darwin_ino_t; /* [???] Used for inodes */
104#else /* !__DARWIN_64_BIT_INO_T */
91447636 105typedef __uint32_t __darwin_ino_t; /* [???] Used for inodes */
2d21ac55 106#endif /* __DARWIN_64_BIT_INO_T */
91447636
A
107typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
108typedef __darwin_mach_port_name_t __darwin_mach_port_t; /* Used by mach */
91447636
A
109typedef __uint16_t __darwin_mode_t; /* [???] Some file attributes */
110typedef __int64_t __darwin_off_t; /* [???] Used for file sizes */
111typedef __int32_t __darwin_pid_t; /* [???] process and group IDs */
112typedef struct _opaque_pthread_attr_t
113 __darwin_pthread_attr_t; /* [???] Used for pthreads */
114typedef struct _opaque_pthread_cond_t
115 __darwin_pthread_cond_t; /* [???] Used for pthreads */
116typedef struct _opaque_pthread_condattr_t
117 __darwin_pthread_condattr_t; /* [???] Used for pthreads */
118typedef unsigned long __darwin_pthread_key_t; /* [???] Used for pthreads */
119typedef struct _opaque_pthread_mutex_t
120 __darwin_pthread_mutex_t; /* [???] Used for pthreads */
121typedef struct _opaque_pthread_mutexattr_t
122 __darwin_pthread_mutexattr_t; /* [???] Used for pthreads */
123typedef struct _opaque_pthread_once_t
124 __darwin_pthread_once_t; /* [???] Used for pthreads */
125typedef struct _opaque_pthread_rwlock_t
126 __darwin_pthread_rwlock_t; /* [???] Used for pthreads */
127typedef struct _opaque_pthread_rwlockattr_t
128 __darwin_pthread_rwlockattr_t; /* [???] Used for pthreads */
129typedef struct _opaque_pthread_t
130 *__darwin_pthread_t; /* [???] Used for pthreads */
131typedef __uint32_t __darwin_sigset_t; /* [???] signal set */
132typedef __int32_t __darwin_suseconds_t; /* [???] microseconds */
133typedef __uint32_t __darwin_uid_t; /* [???] user IDs */
134typedef __uint32_t __darwin_useconds_t; /* [???] microseconds */
135typedef unsigned char __darwin_uuid_t[16];
136
91447636
A
137#ifdef KERNEL
138#ifndef offsetof
139#define offsetof(type, member) ((size_t)(&((type *)0)->member))
140#endif /* offsetof */
141#endif /* KERNEL */
142#endif /* _SYS__TYPES_H_ */