Results 1 to 1 of 1
Suppose I have defined the following.
#define MY_IOCTL_CMD1 _IOR(MAGIC_NUMBER, 0x01, arg1)
#define MY_IOCTL_CMD2 _IOW(MAGIC_NUMBER, 0x02, arg2)
#ifdef CONFIG_COMPAT
#define MY_COMPAT_IOCTL_CMD1 _IOR(MAGIC_NUMBER, 0x01, compat_arg1)
#define MY_COMPAT_IOCTL_CMD2 _IOW(MAGIC_NUMBER, 0x02, compat_arg2)
#endif
Now ...
- 06-07-2011 #1Just Joined!
- Join Date
- Mar 2011
- Posts
- 2
A Query on Compat Ioctl
Suppose I have defined the following.
#define MY_IOCTL_CMD1 _IOR(MAGIC_NUMBER, 0x01, arg1)
#define MY_IOCTL_CMD2 _IOW(MAGIC_NUMBER, 0x02, arg2)
#ifdef CONFIG_COMPAT
#define MY_COMPAT_IOCTL_CMD1 _IOR(MAGIC_NUMBER, 0x01, compat_arg1)
#define MY_COMPAT_IOCTL_CMD2 _IOW(MAGIC_NUMBER, 0x02, compat_arg2)
#endif
Now when we do ioctl from user space, we usually do
ioctl(fd, MY_IOCTL_CMD1, &arg1)
QUESTION: DO WE REALLY NEED TO HAVE AN IOCTL WITH MY_COMPAT_IOCTL_CMD1 AS REQUEST? If YES, then what should be the 3rd parameter &compat_arg1 or &arg1.
In the devide code I have handlers defined as follows.
ioctl: device_ioctl
#ifdef CONFIG_COMPAT
compat_ioctl: device_compat_ioctl
#endif
Can anybody please provide some explanations around this?
Thanks.
Regards
Debapriyay


Reply With Quote
