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