diff options
author | Michael Abbott <michael@araneidae.co.uk> | 2008-08-13 02:09:11 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-13 03:07:31 +0400 |
commit | 5f8c3c8edff426fd87098f057688463107fcd9ce (patch) | |
tree | f0c12022b9513796cc74a389bc47d4b9b013d0e9 /include | |
parent | 666593137185dc0ad1ee8966c8d7fef8f4bb84b2 (diff) | |
download | linux-5f8c3c8edff426fd87098f057688463107fcd9ce.tar.xz |
Make ioctl.h compatible with userland
The attached patch seems to already exist in a number of branches -- it
keeps popping up on Google for me, and is certainly already in Debian --
but is strangely absent from mainstream.
The problem appears to be that the patched file ends up as part of the
target toolchain, but unfortunately the gcc constant folding doesn't
appear to eliminate the __invalid_size_argument_for_IOC value early
enough. Certainly compiling C++ programs which use _IO... macros as
constants fails without this patch.
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/ioctl.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h index 864181385579..15828b2d663c 100644 --- a/include/asm-generic/ioctl.h +++ b/include/asm-generic/ioctl.h @@ -68,12 +68,16 @@ ((nr) << _IOC_NRSHIFT) | \ ((size) << _IOC_SIZESHIFT)) +#ifdef __KERNEL__ /* provoke compile error for invalid uses of size argument */ extern unsigned int __invalid_size_argument_for_IOC; #define _IOC_TYPECHECK(t) \ ((sizeof(t) == sizeof(t[1]) && \ sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ sizeof(t) : __invalid_size_argument_for_IOC) +#else +#define _IOC_TYPECHECK(t) (sizeof(t)) +#endif /* used to create numbers */ #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) |