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