summaryrefslogtreecommitdiffstats
path: root/sys/sys/ioccom.h
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2006-09-27 19:57:02 +0000
committerru <ru@FreeBSD.org>2006-09-27 19:57:02 +0000
commit4ef62e4ca582414062d69e20a1ccdade4a110938 (patch)
treea886251dab8c19f71a5bfd0199ec1d9b327b3513 /sys/sys/ioccom.h
parentf6b387ce531fb4ba91958db5aadcb53f89d4ed1b (diff)
downloadFreeBSD-src-4ef62e4ca582414062d69e20a1ccdade4a110938.zip
FreeBSD-src-4ef62e4ca582414062d69e20a1ccdade4a110938.tar.gz
Fix our ioctl(2) implementation when the argument is "int". New
ioctls passing integer arguments should use the _IOWINT() macro. This fixes a lot of ioctl's not working on sparc64, most notable being keyboard/syscons ioctls. Full ABI compatibility is provided, with the bonus of fixing the handling of old ioctls on sparc64. Reviewed by: bde (with contributions) Tested by: emax, marius MFC after: 1 week
Diffstat (limited to 'sys/sys/ioccom.h')
-rw-r--r--sys/sys/ioccom.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/sys/ioccom.h b/sys/sys/ioccom.h
index 7d25b39..acbd0eb 100644
--- a/sys/sys/ioccom.h
+++ b/sys/sys/ioccom.h
@@ -48,17 +48,25 @@
#define IOC_OUT 0x40000000 /* copy out parameters */
#define IOC_IN 0x80000000 /* copy in parameters */
#define IOC_INOUT (IOC_IN|IOC_OUT)
-#define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */
+#define IOC_DIRMASK (IOC_VOID|IOC_OUT|IOC_IN)
#define _IOC(inout,group,num,len) \
((unsigned long)(inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)))
#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0)
+#define _IOWINT(g,n) _IOC(IOC_VOID, (g), (n), sizeof(int))
#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
/* this should be _IORW, but stdio got there first */
#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
-#ifndef _KERNEL
+#ifdef _KERNEL
+
+#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
+ defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
+#define IOCPARM_IVAL(x) ((int)(intptr_t)(void *)*(caddr_t *)(void *)(x))
+#endif
+
+#else
#include <sys/cdefs.h>
OpenPOWER on IntegriCloud