linux 驱动 --- unlocked_ioctl 与 compat_ioctl 1、compat_ioctl:支持64bit的driver必须要实现的ioctl,当有32bit的userspace application call 64bit kernel的IOCTL的时候,这个callback会被调用到。如果没有实现compat_ioctl,那么32位的用户程序在64位的kernel上执行ioctl时会返回错误:Not a typewriter 2、如果是64...
unlocked_ioctl与compat_ioctl 1、compat_ioctl:支持64bit的driver必须要实现的ioctl,当有32bit的userspace application call 64bit kernel的IOCTL的时候,这个callback会被调用到。如果没有实现compat_ioctl,那么32位的用户程序在64位的kernel上执行ioctl时会返回错误:Not a typewriter 2、如果是64位的用户程序运行在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_COMPAT 2 static long debussy_compat_ioctl (s...
1)支持64位的驱动必须要实现compat_ioctl,当有32位的用户程序调用64位kernel的ioctl时,就会调用到compat_ioctl。如果没有实现compat_ioctl,那么32位的用户程序在64位的kernel上执行ioctl时会返回错误:Not a typewriter。 2)如果是64位的用户程序运行在64位的kernel上,调用的是unlocked_ioctl,如果是32位的用户程序运...
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会...
在kernel 2.6.36中已经完全删除了struct file_operation中的ioctl指针,取而代之的是unlocked_ioctl。 struct file_operations { long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); long (*compat_ioctl) (struct file *, unsigned int, unsigned long); ...
-EFAULT: 0; } #endif /* CONFIG_BLOCK */ #ifdef CONFIG_VT static int vt_check(struct file *file) { struct tty_struct *tty; struct inode *inode = file->f_path.dentry->d_inode; struct vc_data *vc; if (file->f_op->unlocked_ioctl != tty_ioctl) return -EINVAL; tty = (struct...
->unlocked_ioctl) returnret; if(!video_is_registered(vdev)) return-ENODEV; if(_IOC_TYPE(cmd)=='V'&&_IOC_NR(cmd)<BASE_VIDIOC_PRIVATE) ret=file->f_op->unlocked_ioctl(file,cmd, (unsignedlong)compat_ptr(arg)); elseif(vdev->fops->...
First, unlocked_ioctl was introduced. It lets each driver writer choose what lock to use instead. This can be difficult, so there was a period of transition during which old drivers still worked (using ioctl) but new drivers could use the improved interface (unlocked_ioctl). Eventually ...
#include <linux/compat.h> //否则报compat_alloc_user_space找不到 //compact_ioctl中先对arg做些处理,然后直接调用ioctl即可 long compact_ioctl(struct file *file, unsigned