aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-07-29 15:26:18 +0000
committerChristopher Faylor <me@cgf.cx>2005-07-29 15:26:18 +0000
commit728b9af5c9abb690e0510916b38caf26360d4af9 (patch)
tree5f4df1b01f970970a040b3a7dddd4372e2f11df3 /winsup/cygwin
parentb78b8f53ae8531bc0fdec896110ec95c1ddf34d7 (diff)
downloadnewlib-728b9af5c9abb690e0510916b38caf26360d4af9.zip
newlib-728b9af5c9abb690e0510916b38caf26360d4af9.tar.gz
newlib-728b9af5c9abb690e0510916b38caf26360d4af9.tar.bz2
* include/sys/ioctl.h: Add some linux defines.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/include/sys/ioctl.h40
2 files changed, 40 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 43525b2..7cfb16a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,9 @@
2005-07-29 Christopher Faylor <cgf@timesys.com>
+ * include/sys/ioctl.h: Add some linux defines.
+
+2005-07-29 Christopher Faylor <cgf@timesys.com>
+
* pinfo.cc (pinfo::init): Put back accidentally removed debug_printf.
2005-07-29 Arto Huusko <arto.huusko@wmdata.fi>
diff --git a/winsup/cygwin/include/sys/ioctl.h b/winsup/cygwin/include/sys/ioctl.h
index fd9515f..461def6 100644
--- a/winsup/cygwin/include/sys/ioctl.h
+++ b/winsup/cygwin/include/sys/ioctl.h
@@ -1,6 +1,6 @@
/* sys/ioctl.h
- Copyright 1998, 2001, 2002 Red Hat, Inc.
+ Copyright 1998, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
This file is part of Cygwin.
@@ -15,15 +15,47 @@ details. */
#include <sys/cdefs.h>
+__BEGIN_DECLS
+
/* /dev/windows ioctls */
#define WINDOWS_POST 0 /* Set write() behavior to PostMessage() */
#define WINDOWS_SEND 1 /* Set write() behavior to SendMessage() */
#define WINDOWS_HWND 2 /* Set hWnd for read() calls */
-__BEGIN_DECLS
-
-int ioctl (int __fd, int __cmd, ...);
+/* Some standard linux defines */
+
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 14
+#define _IOC_DIRBITS 2
+
+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+#define _IOC_NONE 0U
+#define _IOC_WRITE 1U
+#define _IOC_READ 2U
+
+#define _IOC(dir,type,nr,size) \
+ (((dir) << _IOC_DIRSHIFT) | \
+ + ((type) << _IOC_TYPESHIFT) | \
+ + ((nr) << _IOC_NRSHIFT) | \
+ + ((size) << _IOC_SIZESHIFT))
+
+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+
+int __cdecl ioctl (int __fd, int __cmd, ...);
__END_DECLS