]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/mach_ioctl.h
xnu-201.42.3.tar.gz
[apple/xnu.git] / osfmk / mach / mach_ioctl.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25 /*
26 * HISTORY
27 *
28 * Revision 1.1.1.1 1998/09/22 21:05:30 wsanchez
29 * Import of Mac OS X kernel (~semeria)
30 *
31 * Revision 1.1.1.1 1998/03/07 02:25:45 wsanchez
32 * Import of OSF Mach kernel (~mburg)
33 *
34 * Revision 1.1.4.2 1997/02/07 12:12:35 barbou
35 * Fixed the defines (some were missing the "MACH_" prefixes).
36 * [1997/02/07 12:06:38 barbou]
37 *
38 * Revision 1.1.4.1 1996/11/29 16:59:20 stephen
39 * nmklinux_1.0b3_shared into pmk1.1
40 * Contents of sys/ioctl.h. Prefixed the definitions with "MACH" to avoid
41 * conflicts with UNIX servers.
42 * [96/09/18 barbou]
43 * [1996/11/29 16:33:15 stephen]
44 *
45 * $EndLog$
46 */
47 /*
48 * Mach Operating System
49 * Copyright (c) 1991 Carnegie Mellon University
50 * All Rights Reserved.
51 *
52 * Permission to use, copy, modify and distribute this software and its
53 * documentation is hereby granted, provided that both the copyright
54 * notice and this permission notice appear in all copies of the
55 * software, derivative works or modified versions, and any portions
56 * thereof, and that both notices appear in supporting documentation.
57 *
58 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
59 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
60 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
61 *
62 * Carnegie Mellon requests users of this software to return to
63 *
64 CS.CMU.EDU
65 * School of Computer Science
66 * Carnegie Mellon University
67 * Pittsburgh PA 15213-3890
68 *
69 * any improvements or extensions that they make and grant Carnegie Mellon rights
70 * to redistribute these changes.
71 */
72 /*
73 */
74 /*
75 * Format definitions for 'ioctl' commands in device definitions.
76 *
77 * From BSD4.4.
78 */
79
80 #ifndef _MACH_MACH_IOCTL_H_
81 #define _MACH_MACH_IOCTL_H_
82
83 /*
84 * Ioctl's have the command encoded in the lower word, and the size of
85 * any in or out parameters in the upper word. The high 3 bits of the
86 * upper word are used to encode the in/out status of the parameter.
87 */
88 #define MACH_IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
89 #define MACH_IOC_VOID 0x20000000 /* no parameters */
90 #define MACH_IOC_OUT 0x40000000 /* copy out parameters */
91 #define MACH_IOC_IN 0x80000000 /* copy in parameters */
92 #define MACH_IOC_INOUT (MACH_IOC_IN|MACH_IOC_OUT)
93
94 #define _MACH_IOC(inout,group,num,len) \
95 (inout | ((len & MACH_IOCPARM_MASK) << 16) | ((group) << 8) | (num))
96 #define _MACH_IO(g,n) _MACH_IOC(MACH_IOC_VOID, (g), (n), 0)
97 #define _MACH_IOR(g,n,t) _MACH_IOC(MACH_IOC_OUT, (g), (n), sizeof(t))
98 #define _MACH_IOW(g,n,t) _MACH_IOC(MACH_IOC_IN, (g), (n), sizeof(t))
99 #define _MACH_IOWR(g,n,t) _MACH_IOC(MACH_IOC_INOUT, (g), (n), sizeof(t))
100
101 #ifdef MACH_KERNEL
102 /*
103 * to avoid changing the references in the micro-kernel sources...
104 */
105 #define IOCPARM_MASK MACH_IOCPARM_MASK
106 #define IOC_VOID MACH_IOC_VOID
107 #define IOC_OUT MACH_IOC_OUT
108 #define IOC_IN MACH_IOC_IN
109 #define IOC_INOUT MACH_IOC_INOUT
110 #define _IOC _MACH_IOC
111 #define _IO _MACH_IO
112 #define _IOR _MACH_IOR
113 #define _IOW _MACH_IOW
114 #define _IOWR _MACH_IOWR
115 #endif /* MACH_KERNEL */
116
117 #endif /* _MACH_MACH_IOCTL_H_ */