I am using Rhel5 (kernel 2.6)
I am getting following compilation error from ioctl.h.

error: '__invalid_size_argument_for_IOC' cannot appear in a constant-expression

I modified the ioctl.h to fix the problem:
+ #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

I added the condition "#ifdef __KERNEL__"
I am checking whether "__KERNEL__" is defined, since it is not defined, It executes the else part and does not throw error.

The same problem is seen with Rhel5.1.

Since it is not good to modify "ioctl.h", Can anyone please let me know how it can be handled through the program.