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