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