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