xref: /xnu-10002.41.9/bsd/sys/kernel_types.h (revision 699cd48037512bf4380799317ca44ca453c82f57)
1*699cd480SApple OSS Distributions /*
2*699cd480SApple OSS Distributions  * Copyright (c) 2004-2010 Apple Inc. All rights reserved.
3*699cd480SApple OSS Distributions  *
4*699cd480SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*699cd480SApple OSS Distributions  *
6*699cd480SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*699cd480SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*699cd480SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*699cd480SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*699cd480SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*699cd480SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*699cd480SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*699cd480SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*699cd480SApple OSS Distributions  *
15*699cd480SApple OSS Distributions  * Please obtain a copy of the License at
16*699cd480SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*699cd480SApple OSS Distributions  *
18*699cd480SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*699cd480SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*699cd480SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*699cd480SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*699cd480SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*699cd480SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*699cd480SApple OSS Distributions  * limitations under the License.
25*699cd480SApple OSS Distributions  *
26*699cd480SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*699cd480SApple OSS Distributions  */
28*699cd480SApple OSS Distributions 
29*699cd480SApple OSS Distributions #ifndef _KERN_SYS_KERNELTYPES_H_
30*699cd480SApple OSS Distributions #define _KERN_SYS_KERNELTYPES_H_
31*699cd480SApple OSS Distributions 
32*699cd480SApple OSS Distributions #include <sys/cdefs.h>
33*699cd480SApple OSS Distributions #include <sys/constrained_ctypes.h>
34*699cd480SApple OSS Distributions #include <sys/types.h>
35*699cd480SApple OSS Distributions #include <sys/_types/_mount_t.h>
36*699cd480SApple OSS Distributions #include <sys/_types/_vnode_t.h>
37*699cd480SApple OSS Distributions #include <stdint.h>
38*699cd480SApple OSS Distributions 
39*699cd480SApple OSS Distributions #ifdef BSD_BUILD
40*699cd480SApple OSS Distributions /* Macros(?) to clear/set/test flags. */
41*699cd480SApple OSS Distributions #define SET(t, f)       (t) |= (f)
42*699cd480SApple OSS Distributions #define CLR(t, f)       (t) &= ~(f)
43*699cd480SApple OSS Distributions #define ISSET(t, f)     ((t) & (f))
44*699cd480SApple OSS Distributions #endif
45*699cd480SApple OSS Distributions 
46*699cd480SApple OSS Distributions 
47*699cd480SApple OSS Distributions typedef int64_t daddr64_t;
48*699cd480SApple OSS Distributions 
49*699cd480SApple OSS Distributions #ifndef BSD_BUILD
50*699cd480SApple OSS Distributions struct buf;
51*699cd480SApple OSS Distributions typedef struct buf * buf_t;
52*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct buf, buf);
53*699cd480SApple OSS Distributions 
54*699cd480SApple OSS Distributions struct file;
55*699cd480SApple OSS Distributions typedef struct file * file_t;
56*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct file, file);
57*699cd480SApple OSS Distributions 
58*699cd480SApple OSS Distributions #ifndef __LP64__
59*699cd480SApple OSS Distributions struct ucred;
60*699cd480SApple OSS Distributions typedef struct ucred * ucred_t;
61*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ucred, ucred);
62*699cd480SApple OSS Distributions #endif
63*699cd480SApple OSS Distributions 
64*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct mount, mount);
65*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vnode, vnode);
66*699cd480SApple OSS Distributions 
67*699cd480SApple OSS Distributions struct proc;
68*699cd480SApple OSS Distributions typedef struct proc * proc_t;
69*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct proc, proc);
70*699cd480SApple OSS Distributions 
71*699cd480SApple OSS Distributions struct proc_ident;
72*699cd480SApple OSS Distributions typedef struct proc_ident * proc_ident_t;
73*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct proc_ident, proc_ident);
74*699cd480SApple OSS Distributions 
75*699cd480SApple OSS Distributions struct uio;
76*699cd480SApple OSS Distributions typedef struct uio * uio_t;
77*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct uio, uio);
78*699cd480SApple OSS Distributions 
79*699cd480SApple OSS Distributions struct vfs_context;
80*699cd480SApple OSS Distributions typedef struct vfs_context * vfs_context_t;
81*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vfs_context, vfs_context);
82*699cd480SApple OSS Distributions 
83*699cd480SApple OSS Distributions struct vfstable;
84*699cd480SApple OSS Distributions typedef struct vfstable * vfstable_t;
85*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vfstable, vfstable);
86*699cd480SApple OSS Distributions 
87*699cd480SApple OSS Distributions struct __ifnet;
88*699cd480SApple OSS Distributions struct __mbuf;
89*699cd480SApple OSS Distributions struct __pkthdr;
90*699cd480SApple OSS Distributions struct __socket;
91*699cd480SApple OSS Distributions struct __sockopt;
92*699cd480SApple OSS Distributions struct __ifaddr;
93*699cd480SApple OSS Distributions struct __ifmultiaddr;
94*699cd480SApple OSS Distributions struct __ifnet_filter;
95*699cd480SApple OSS Distributions struct __rtentry;
96*699cd480SApple OSS Distributions struct __if_clone;
97*699cd480SApple OSS Distributions struct __bufattr;
98*699cd480SApple OSS Distributions 
99*699cd480SApple OSS Distributions typedef struct __ifnet*                 ifnet_t;
100*699cd480SApple OSS Distributions typedef struct __mbuf*                  mbuf_t;
101*699cd480SApple OSS Distributions typedef struct __pkthdr*                pkthdr_t;
102*699cd480SApple OSS Distributions typedef struct __socket*                socket_t;
103*699cd480SApple OSS Distributions typedef struct __sockopt*               sockopt_t;
104*699cd480SApple OSS Distributions typedef struct __ifaddr*                ifaddr_t;
105*699cd480SApple OSS Distributions typedef struct __ifmultiaddr*   ifmultiaddr_t;
106*699cd480SApple OSS Distributions typedef struct __ifnet_filter*  interface_filter_t;
107*699cd480SApple OSS Distributions typedef struct __rtentry*               route_t;
108*699cd480SApple OSS Distributions typedef struct __if_clone*              if_clone_t;
109*699cd480SApple OSS Distributions typedef struct __bufattr*               bufattr_t;
110*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __ifnet, ifnet);
111*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __mbuf, mbuf);
112*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __pkthdr, pkthdr);
113*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __socket, socket);
114*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __sockopt, sockopt);
115*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __ifaddr, ifaddr);
116*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __ifmultiaddr, ifmultiaddr);
117*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __ifnet_filter, ifnet_filter);
118*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __rtentry, rtentry);
119*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __if_clone, if_clone);
120*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct __bufattr, bufattr);
121*699cd480SApple OSS Distributions 
122*699cd480SApple OSS Distributions #else /* BSD_BUILD */
123*699cd480SApple OSS Distributions 
124*699cd480SApple OSS Distributions typedef struct buf * buf_t;
125*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct buf, buf);
126*699cd480SApple OSS Distributions 
127*699cd480SApple OSS Distributions typedef struct file * file_t;
128*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct file, file);
129*699cd480SApple OSS Distributions 
130*699cd480SApple OSS Distributions #ifndef __LP64__
131*699cd480SApple OSS Distributions typedef struct ucred * ucred_t;
132*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ucred, ucred);
133*699cd480SApple OSS Distributions #endif
134*699cd480SApple OSS Distributions 
135*699cd480SApple OSS Distributions #if defined(KERNEL) || !defined(_SYS_MOUNT_H_) /* also defined in mount.h */
136*699cd480SApple OSS Distributions 
137*699cd480SApple OSS Distributions typedef struct mount * mount_t;
138*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct mount, mount);
139*699cd480SApple OSS Distributions 
140*699cd480SApple OSS Distributions typedef struct vnode * vnode_t;
141*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vnode, vnode);
142*699cd480SApple OSS Distributions #endif
143*699cd480SApple OSS Distributions typedef struct proc * proc_t;
144*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct proc, proc);
145*699cd480SApple OSS Distributions 
146*699cd480SApple OSS Distributions typedef struct proc_ident * proc_ident_t;
147*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct proc_ident, proc_ident);
148*699cd480SApple OSS Distributions 
149*699cd480SApple OSS Distributions typedef struct uio * uio_t;
150*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct uio, uio);
151*699cd480SApple OSS Distributions 
152*699cd480SApple OSS Distributions typedef struct user_iovec * user_iovec_t;
153*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct user_iovec, user_iovec);
154*699cd480SApple OSS Distributions 
155*699cd480SApple OSS Distributions typedef struct vfs_context * vfs_context_t;
156*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vfs_context, vfs_context);
157*699cd480SApple OSS Distributions 
158*699cd480SApple OSS Distributions typedef struct vfstable * vfstable_t;
159*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct vfstable, vfstable);
160*699cd480SApple OSS Distributions 
161*699cd480SApple OSS Distributions #ifdef KERNEL_PRIVATE
162*699cd480SApple OSS Distributions typedef struct kern_iovec * kern_iovec_t;
163*699cd480SApple OSS Distributions typedef struct ifnet*           ifnet_t;
164*699cd480SApple OSS Distributions typedef struct mbuf*            mbuf_t;
165*699cd480SApple OSS Distributions typedef struct pkthdr*          pkthdr_t;
166*699cd480SApple OSS Distributions typedef struct socket*          socket_t;
167*699cd480SApple OSS Distributions typedef struct sockopt*         sockopt_t;
168*699cd480SApple OSS Distributions typedef struct ifaddr*          ifaddr_t;
169*699cd480SApple OSS Distributions typedef struct ifmultiaddr*     ifmultiaddr_t;
170*699cd480SApple OSS Distributions typedef struct ifnet_filter*    interface_filter_t;
171*699cd480SApple OSS Distributions typedef struct rtentry*         route_t;
172*699cd480SApple OSS Distributions typedef struct if_clone*        if_clone_t;
173*699cd480SApple OSS Distributions typedef struct bufattr*         bufattr_t;
174*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct kern_iovec, kern_iovec);
175*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ifnet, ifnet);
176*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct mbuf, mbuf);
177*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct pkthdr, pkthdr);
178*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct socket, socket);
179*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockopt, sockopt);
180*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ifaddr, ifaddr);
181*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ifmultiaddr, ifmultiaddr);
182*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct ifnet_filter, ifnet_filter);
183*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct rtentry, rtentry);
184*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct if_clone, if_clone);
185*699cd480SApple OSS Distributions __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct bufattr, bufattr);
186*699cd480SApple OSS Distributions 
187*699cd480SApple OSS Distributions #endif /* KERNEL_PRIVATE */
188*699cd480SApple OSS Distributions 
189*699cd480SApple OSS Distributions #endif /* !BSD_BUILD */
190*699cd480SApple OSS Distributions 
191*699cd480SApple OSS Distributions #include <sys/_types/_guid_t.h>
192*699cd480SApple OSS Distributions 
193*699cd480SApple OSS Distributions #ifndef _KAUTH_ACE
194*699cd480SApple OSS Distributions #define _KAUTH_ACE
195*699cd480SApple OSS Distributions struct kauth_ace;
196*699cd480SApple OSS Distributions typedef struct kauth_ace * kauth_ace_t;
197*699cd480SApple OSS Distributions #endif
198*699cd480SApple OSS Distributions #ifndef _KAUTH_ACL
199*699cd480SApple OSS Distributions #define _KAUTH_ACL
200*699cd480SApple OSS Distributions struct kauth_acl;
201*699cd480SApple OSS Distributions typedef struct kauth_acl * kauth_acl_t;
202*699cd480SApple OSS Distributions #endif
203*699cd480SApple OSS Distributions #ifndef _KAUTH_FILESEC
204*699cd480SApple OSS Distributions #define _KAUTH_FILESEC
205*699cd480SApple OSS Distributions struct kauth_filesec;
206*699cd480SApple OSS Distributions typedef struct kauth_filesec * kauth_filesec_t;
207*699cd480SApple OSS Distributions #endif
208*699cd480SApple OSS Distributions 
209*699cd480SApple OSS Distributions #ifndef _KAUTH_ACTION_T
210*699cd480SApple OSS Distributions #define _KAUTH_ACTION_T
211*699cd480SApple OSS Distributions typedef int kauth_action_t;
212*699cd480SApple OSS Distributions #endif
213*699cd480SApple OSS Distributions 
214*699cd480SApple OSS Distributions #endif /* !_KERN_SYS_KERNELTYPES_H_ */
215