1/*
2 * Copyright (c) 2004-2010 Apple 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#ifndef _KERN_SYS_KERNELTYPES_H_
30#define _KERN_SYS_KERNELTYPES_H_
31
32#include <sys/cdefs.h>
33#include <sys/constrained_ctypes.h>
34#include <sys/types.h>
35#include <sys/_types/_mount_t.h>
36#include <sys/_types/_vnode_t.h>
37#include <stdint.h>
38
39#ifdef BSD_BUILD
40/* Macros(?) to clear/set/test flags. */
41#define SET(t, f) (t) |= (f)
42#define CLR(t, f) (t) &= ~(f)
43#define ISSET(t, f) ((t) & (f))
44#endif
45
46
47typedef int64_t daddr64_t;
48
49#ifndef BSD_BUILD
50struct buf;
51typedef struct buf * buf_t;
52__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct buf, buf);
53
54struct file;
55typedef struct file * file_t;
56__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct file, file);
57
58#ifndef __LP64__
59struct ucred;
60typedef struct ucred * ucred_t;
61__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ucred, ucred);
62#endif
63
64__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct mount, mount);
65__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vnode, vnode);
66
67struct proc;
68typedef struct proc * proc_t;
69__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct proc, proc);
70
71struct proc_ident;
72typedef struct proc_ident * proc_ident_t;
73__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct proc_ident, proc_ident);
74
75struct uio;
76typedef struct uio * uio_t;
77__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct uio, uio);
78
79struct vfs_context;
80typedef struct vfs_context * vfs_context_t;
81__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vfs_context, vfs_context);
82
83struct vfstable;
84typedef struct vfstable * vfstable_t;
85__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vfstable, vfstable);
86
87struct __ifnet;
88struct __mbuf;
89struct __pkthdr;
90struct __socket;
91struct __sockopt;
92struct __ifaddr;
93struct __ifmultiaddr;
94struct __ifnet_filter;
95struct __rtentry;
96struct __if_clone;
97struct __bufattr;
98
99typedef struct __ifnet* ifnet_t;
100typedef struct __mbuf* mbuf_t;
101typedef struct __pkthdr* pkthdr_t;
102typedef struct __socket* socket_t;
103typedef struct __sockopt* sockopt_t;
104typedef struct __ifaddr* ifaddr_t;
105typedef struct __ifmultiaddr* ifmultiaddr_t;
106typedef struct __ifnet_filter* interface_filter_t;
107typedef struct __rtentry* route_t;
108typedef struct __if_clone* if_clone_t;
109typedef struct __bufattr* bufattr_t;
110__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __ifnet, ifnet);
111__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __mbuf, mbuf);
112__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __pkthdr, pkthdr);
113__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __socket, socket);
114__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __sockopt, sockopt);
115__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __ifaddr, ifaddr);
116__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __ifmultiaddr, ifmultiaddr);
117__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __ifnet_filter, ifnet_filter);
118__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __rtentry, rtentry);
119__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __if_clone, if_clone);
120__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __bufattr, bufattr);
121
122#else /* BSD_BUILD */
123
124typedef struct buf * buf_t;
125__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct buf, buf);
126
127typedef struct file * file_t;
128__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct file, file);
129
130#ifndef __LP64__
131typedef struct ucred * ucred_t;
132__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ucred, ucred);
133#endif
134
135#if defined(KERNEL) || !defined(_SYS_MOUNT_H_) /* also defined in mount.h */
136
137typedef struct mount * mount_t;
138__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct mount, mount);
139
140typedef struct vnode * vnode_t;
141__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vnode, vnode);
142#endif
143typedef struct proc * proc_t;
144__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct proc, proc);
145
146typedef struct proc_ident * proc_ident_t;
147__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct proc_ident, proc_ident);
148
149typedef struct uio * uio_t;
150__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct uio, uio);
151
152typedef struct user_iovec * user_iovec_t;
153__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct user_iovec, user_iovec);
154
155typedef struct vfs_context * vfs_context_t;
156__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vfs_context, vfs_context);
157
158typedef struct vfstable * vfstable_t;
159__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vfstable, vfstable);
160
161#ifdef KERNEL_PRIVATE
162typedef struct kern_iovec * kern_iovec_t;
163typedef struct ifnet* ifnet_t;
164typedef struct mbuf* mbuf_t;
165typedef struct pkthdr* pkthdr_t;
166typedef struct socket* socket_t;
167typedef struct sockopt* sockopt_t;
168typedef struct ifaddr* ifaddr_t;
169typedef struct ifmultiaddr* ifmultiaddr_t;
170typedef struct ifnet_filter* interface_filter_t;
171typedef struct rtentry* route_t;
172typedef struct if_clone* if_clone_t;
173typedef struct bufattr* bufattr_t;
174__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct kern_iovec, kern_iovec);
175__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ifnet, ifnet);
176__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct mbuf, mbuf);
177__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct pkthdr, pkthdr);
178__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct socket, socket);
179__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockopt, sockopt);
180__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ifaddr, ifaddr);
181__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ifmultiaddr, ifmultiaddr);
182__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ifnet_filter, ifnet_filter);
183__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct rtentry, rtentry);
184__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct if_clone, if_clone);
185__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct bufattr, bufattr);
186
187#endif /* KERNEL_PRIVATE */
188
189#endif /* !BSD_BUILD */
190
191#include <sys/_types/_guid_t.h>
192
193#ifndef _KAUTH_ACE
194#define _KAUTH_ACE
195struct kauth_ace;
196typedef struct kauth_ace * kauth_ace_t;
197#endif
198#ifndef _KAUTH_ACL
199#define _KAUTH_ACL
200struct kauth_acl;
201typedef struct kauth_acl * kauth_acl_t;
202#endif
203#ifndef _KAUTH_FILESEC
204#define _KAUTH_FILESEC
205struct kauth_filesec;
206typedef struct kauth_filesec * kauth_filesec_t;
207#endif
208
209#ifndef _KAUTH_ACTION_T
210#define _KAUTH_ACTION_T
211typedef int kauth_action_t;
212#endif
213
214#endif /* !_KERN_SYS_KERNELTYPES_H_ */
215