FreeBSD/Linux Kernel Cross Reference
sys/sys/ioctl.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon rights
24 * to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: ioctl.h,v $
29 * Revision 2.6 92/05/21 17:25:06 jfriedl
30 * Appended 'U' to constants that would otherwise be signed.
31 * [92/05/16 jfriedl]
32 *
33 * Revision 2.5 91/10/09 16:18:46 af
34 * Revision 2.4.1.1 91/09/01 15:53:00 af
35 * Upgraded to BSD 4.4.
36 * [91/09/01 af]
37 *
38 * Revision 2.4.1.1 91/09/01 15:53:00 af
39 * Upgraded to BSD 4.4.
40 * [91/09/01 af]
41 *
42 * Revision 2.4 91/05/14 17:40:04 mrt
43 * Correcting copyright
44 *
45 * Revision 2.3 91/03/16 15:01:35 rpd
46 * Fixed the definitions for ANSI C.
47 * [91/02/20 rpd]
48 *
49 * Revision 2.2 91/02/14 15:04:02 mrt
50 * Changed to new Mach copyright
51 *
52 *
53 */
54 /*
55 * Format definitions for 'ioctl' commands in device definitions.
56 *
57 * From BSD4.4.
58 */
59
60 #ifndef _SYS_IOCTL_H_
61 #define _SYS_IOCTL_H_
62 /*
63 * Ioctl's have the command encoded in the lower word, and the size of
64 * any in or out parameters in the upper word. The high 3 bits of the
65 * upper word are used to encode the in/out status of the parameter.
66 */
67 #define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
68 #define IOC_VOID 0x20000000 /* no parameters */
69 #define IOC_OUT 0x40000000 /* copy out parameters */
70 #define IOC_IN 0x80000000U /* copy in parameters */
71 #define IOC_INOUT (IOC_IN|IOC_OUT)
72
73 #define _IOC(inout,group,num,len) \
74 (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
75 #define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0)
76 #define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
77 #define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
78 #define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
79
80 #endif _SYS_IOCTL_H_
Cache object: 2fd5906fbacd49868837d26cbfa766fd
|