ioctl.h

Go to the documentation of this file.
00001 /*      minix/ioctl.h - Ioctl helper definitions.       Author: Kees J. Bot
00002  *                                                              23 Nov 2002
00003  *
00004  * This file is included by every header file that defines ioctl codes.
00005  */
00006 
00007 #ifndef _M_IOCTL_H
00008 #define _M_IOCTL_H
00009 
00010 #ifndef _TYPES_H
00011 #include <sys/types.h>
00012 #endif
00013 
00014 #if _EM_WSIZE >= 4
00015 /* Ioctls have the command encoded in the low-order word, and the size
00016  * of the parameter in the high-order word. The 3 high bits of the high-
00017  * order word are used to encode the in/out/void status of the parameter.
00018  */
00019 #define _IOCPARM_MASK   0x1FFF
00020 #define _IOC_VOID       0x20000000
00021 #define _IOCTYPE_MASK   0xFFFF
00022 #define _IOC_IN         0x40000000
00023 #define _IOC_OUT        0x80000000
00024 #define _IOC_INOUT      (_IOC_IN | _IOC_OUT)
00025 
00026 #define _IO(x,y)        ((x << 8) | y | _IOC_VOID)
00027 #define _IOR(x,y,t)     ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
00028                                 _IOC_OUT)
00029 #define _IOW(x,y,t)     ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
00030                                 _IOC_IN)
00031 #define _IORW(x,y,t)    ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
00032                                 _IOC_INOUT)
00033 #else
00034 /* No fancy encoding on a 16-bit machine. */
00035 
00036 #define _IO(x,y)        ((x << 8) | y)
00037 #define _IOR(x,y,t)     _IO(x,y)
00038 #define _IOW(x,y,t)     _IO(x,y)
00039 #define _IORW(x,y,t)    _IO(x,y)
00040 #endif
00041 
00042 int ioctl(int _fd, int _request, void *_data);
00043 
00044 #endif /* _M_IOCTL_H */

Generated on Fri Apr 14 22:57:20 2006 for minix by  doxygen 1.4.6