]> sourceware.org Git - newlib-cygwin.git/blob - winsup/cygwin/include/sys/ioctl.h
6289e7da79ad9912548eb0485f7c694141945182
[newlib-cygwin.git] / winsup / cygwin / include / sys / ioctl.h
1 /* sys/ioctl.h
2
3 This file is part of Cygwin.
4
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
7 details. */
8
9 /* sys/ioctl.h */
10
11 #ifndef _SYS_IOCTL_H
12 #define _SYS_IOCTL_H
13
14 #include <sys/cdefs.h>
15 #include <sys/termios.h>
16
17 __BEGIN_DECLS
18
19 /* /dev/windows ioctls */
20
21 #define WINDOWS_POST 0 /* Set write() behavior to PostMessage() */
22 #define WINDOWS_SEND 1 /* Set write() behavior to SendMessage() */
23 #define WINDOWS_HWND 2 /* Set hWnd for read() calls */
24
25 /* Some standard linux defines */
26
27 #define _IOC_NRBITS 8
28 #define _IOC_TYPEBITS 8
29 #define _IOC_SIZEBITS 14
30 #define _IOC_DIRBITS 2
31
32 #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
33 #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
34 #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
35 #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
36
37 #define _IOC_NRSHIFT 0
38 #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
39 #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
40 #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
41
42 #define _IOC_NONE 0U
43 #define _IOC_WRITE 1U
44 #define _IOC_READ 2U
45
46 #define _IOC(dir,type,nr,size) \
47 (((dir) << _IOC_DIRSHIFT) | \
48 + ((type) << _IOC_TYPESHIFT) | \
49 + ((nr) << _IOC_NRSHIFT) | \
50 + ((size) << _IOC_SIZESHIFT))
51
52 #define _LINUX_IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
53 #define _LINUX_IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
54 #define _LINUX_IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
55 #define _LINUX_IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
56
57 #ifdef __USE_LINUX_IOCTL_DEFS
58 # define _IO _LINUX_IO
59 # define _IOR _LINUX_IOR
60 # define _IOW _LINUX_IOW
61 # define _IOWR _LINUX_IOWR
62 #endif /*__USE_LINUX_IOCTL_DEFS */
63
64 int ioctl (int __fd, int __cmd, ...);
65
66 __END_DECLS
67 #endif
This page took 0.045428 seconds and 6 git commands to generate.