]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/mach_ioctl.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
28 * Revision 1.1.1.1 1998/09/22 21:05:30 wsanchez
29 * Import of Mac OS X kernel (~semeria)
31 * Revision 1.1.1.1 1998/03/07 02:25:45 wsanchez
32 * Import of OSF Mach kernel (~mburg)
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]
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.
43 * [1996/11/29 16:33:15 stephen]
48 * Mach Operating System
49 * Copyright (c) 1991 Carnegie Mellon University
50 * All Rights Reserved.
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.
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.
62 * Carnegie Mellon requests users of this software to return to
65 * School of Computer Science
66 * Carnegie Mellon University
67 * Pittsburgh PA 15213-3890
69 * any improvements or extensions that they make and grant Carnegie Mellon rights
70 * to redistribute these changes.
75 * Format definitions for 'ioctl' commands in device definitions.
80 #ifndef _MACH_MACH_IOCTL_H_
81 #define _MACH_MACH_IOCTL_H_
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.
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)
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))
103 * to avoid changing the references in the micro-kernel sources...
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
112 #define _IOR _MACH_IOR
113 #define _IOW _MACH_IOW
114 #define _IOWR _MACH_IOWR
115 #endif /* MACH_KERNEL */
117 #endif /* _MACH_MACH_IOCTL_H_ */