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