long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); long (*compat_ioctl) (struct file *, unsigned int, unsigned long); ... ... }; 注意: 1、compat_ioctl:支持64bit的driver必须要实现的ioctl,当有32bit的userspace application call 64bit kernel的IOCTL的时候,这个callback会...
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); long (*compat_ioctl) (struct file *, unsigned int, unsigned long); ... ... }; 1. 2. 3. 4. 5. 6. 注意: 1、compat_ioctl:支持64bit的driver必须要实现的ioctl,当有32bit的userspace application call 64bit kernel的...
1. 历史由来 Linux刚开始只有ioctl,没有unlocked_ioctl和compat_ioctl,这时候还是大内核锁机制(BKL),后来因为大内核锁的各种争议而去掉了ioctl,增加了unlocked_ioctl,顾名思义,unlocked就是无锁,因为unlocked_ioctl没了锁,如果想要并发操作,就要在unlocked_ioctl内部实现锁。再后来,为了让32位用户程序能访问64位内核,...
如果没有实现compat_ioctl,那么32位的用户程序在64位的kernel上执行ioctl时会返回错误:Not a typewriter 2、如果是64位的用户程序运行在64位的kernel上,调用的是unlocked_ioctl,如果是32位的APP运行在32位的kernel上,调用的也是unlocked_ioctl 示例: 1#ifdef CONFIG_COMPAT2staticlongdebussy_compat_ioctl (structfile...
compat_ioctl和unlocked_ioctl的转换问题 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #include <linux/compat.h> //否则报compat_alloc_user_space找不到 //compact_ioctl中先对arg做些处理,然后直接调用ioctl即可 long...