source: branches/minix3-book/include/minix/ioctl.h@ 4

Last change on this file since 4 was 4, checked in by Mattia Monga, 13 years ago

Importazione sorgenti libro

File size: 1.2 KB
Line 
1/* minix/ioctl.h - Ioctl helper definitions. Author: Kees J. Bot
2 * 23 Nov 2002
3 *
4 * This file is included by every header file that defines ioctl codes.
5 */
6
7#ifndef _M_IOCTL_H
8#define _M_IOCTL_H
9
10#ifndef _TYPES_H
11#include <sys/types.h>
12#endif
13
14#if _EM_WSIZE >= 4
15/* Ioctls have the command encoded in the low-order word, and the size
16 * of the parameter in the high-order word. The 3 high bits of the high-
17 * order word are used to encode the in/out/void status of the parameter.
18 */
19#define _IOCPARM_MASK 0x1FFF
20#define _IOC_VOID 0x20000000
21#define _IOCTYPE_MASK 0xFFFF
22#define _IOC_IN 0x40000000
23#define _IOC_OUT 0x80000000
24#define _IOC_INOUT (_IOC_IN | _IOC_OUT)
25
26#define _IO(x,y) ((x << 8) | y | _IOC_VOID)
27#define _IOR(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
28 _IOC_OUT)
29#define _IOW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
30 _IOC_IN)
31#define _IORW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
32 _IOC_INOUT)
33#else
34/* No fancy encoding on a 16-bit machine. */
35
36#define _IO(x,y) ((x << 8) | y)
37#define _IOR(x,y,t) _IO(x,y)
38#define _IOW(x,y,t) _IO(x,y)
39#define _IORW(x,y,t) _IO(x,y)
40#endif
41
42int ioctl(int _fd, int _request, void *_data);
43
44#endif /* _M_IOCTL_H */
Note: See TracBrowser for help on using the repository browser.