ioctl,unlocked_ioctl 处理方法
来源:互联网 发布:频无损剪切软件 编辑:程序博客网 时间:2024/05/16 06:18
在kernel 2.6.36 中已经完全删除了struct file_operations 中的ioctl 函数指针,取而代之的是unlocked_ioctl 。
compat_ioctl少了inode参数, 可以通过filp->f_dentry->d_inode方法获得。
http://blog.csdn.net/zhangqingsup/article/details/5721924
区别:
ioctl 和 unlock_ioctl
ioctl 不会lock_kernel()
compat_ioctl被使用在用户空间为32位模式,而内核运行在64位模式时。这时候,需要将64位转成32位。
引用
http://blog.chinaunix.net/u1/38994/showart_2248151.html
对几个ioctl执行顺序的分析
关于ioctl,unlocked_ioctl和compat_ioctl执行的顺序
对于ioctl操作,优先执行f_op->unlocked_ioctl,如果没有unlocked_ioctl,那么执行f_op->ioctl
sys_ioctl
==> vfs_ioctl
==> file_ioctl
==> do_ioctl
static long do_ioctl(struct file *filp, unsigned int cmd,
{
}
对于compat_sys_ioctl系统调用的使用比较麻烦一些,因为默认kernel是不将它built-in进内核的,
可以通过fs/Makefile看到如下定义obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o
对于CONFIG_COMPAT的定义于cpu体系结构有关,比如下面几个默认cpu配置了CONFIG_COMPAT=y
arch/x86_64/defconfig
arch/sparc64/defconfig
arch/powerpc/configs/ppc64_defconfig
arch/s390/defconfig
arch/parisc/configs/a500_defconfig
arch/mips/configs/ip32_defconfig
compat_sys_ioctl
filp->f_op->compat_ioctl(filp, cmd, arg);
如果该cmd在compat_ioctl中没有找到对应的处理,同时没有filp->f_op方法集[luther.gliethttp]
或者filp->f_op->ioct且filp->f_op->unlocked_ioctl均没有,那么将尝试调用vfs_ioctl,看看是不是一些经典的ioctl命令.
对于sound/core/control.c文件[luther.gliethttp]
#ifdef CONFIG_COMPAT
#include "control_compat.c"
#else
#define snd_ctl_ioctl_compat
#endif
下面的"controlC%i"声卡对应的控制节点fops的compat_ioctl,当没有定义CONFIG_COMPAT时,将被置为NULL
static const struct file_operations snd_ctl_f_ops =
{
};
- ioctl,unlocked_ioctl 处理方法
- ioctl,unlocked_ioctl 处理方法
- ioctl,unlocked_ioctl 处理方法
- ioctl,unlocked_ioctl 处理方法【转】
- ioctl 变成了 unlocked_ioctl
- ioctl与unlocked_ioctl区别
- ioctl 变成了 unlocked_ioctl
- ioctl与unlocked_ioctl区别
- ioctl与unlocked_ioctl
- ioctl与unlocked_ioctl区别
- ioctl与unlocked_ioctl区别
- ioctl 与unlocked_ioctl
- ioctl 变成了 unlocked_ioctl
- ioctl 变成了 unlocked_ioctl
- ioctl/unlocked_ioctl/compat_ioctl
- 【转】ioctl 变成了 unlocked_ioctl
- ioctl 变成了 unlocked_ioctl[转]
- ioctl与unlocked_ioctl的区别
- 【算法导论】程序出错的解释说明
- 【xtku】保密至上!删除共享文档有绝招
- IOS之HTTP请求
- Oracle查询表结构的方法
- JQuery动态显示当前选中节点的父节点
- ioctl,unlocked_ioctl 处理方法
- javascript--弹出对话框 四种对话框 获得用户输入值 .
- ubuntu12.0.4下安装eclipse
- VB数据库编程新手入门必会
- Source Insight 显示全路径
- 使用JDK的keytool来为Tomcat配置SSL认证(一)
- CALayer实现,界限、透明度、位置、旋转、缩放组合动画
- Android开发之XML文件解析
- File not found: MaskProp.dcu