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)
Q: Do we need to have ioctl with MY_COMPAT_IOCTL_CMD1as request?
In the division code, I have handlers defined as follows. ioctl: device_ioctl
#ifdef CONFIG_COMPAT
compat_ioctl: device_compat_ioctl
#endif
Can someone explain some clarifications?
source
share