unlocked_ioctl与正常的ioctl [英] unlocked_ioctl vs normal ioctl

查看:623
本文介绍了unlocked_ioctl与正常的ioctl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的驾驶file_operations结构,我有:

In my driver's file_operations structure, I have:

struct file_operations Fops = {
  read:    device_read,
  write:   device_write,
  unlocked_ioctl:   device_ioctl,
  ...
};

即。有没有使用的ioctl领域。这是足以避免大内核锁,没有任何同步进入device_ioctl()?或做我必须要改变的ioctl()在code的用户空间部分过电话?

I.e. there is no ioctl field used. Is this sufficient to avoid Big Kernel Lock and enter into device_ioctl() without any synchronization? Or do I have to change ioctl() calls in userspace part of the code too?

推荐答案

嗯,我解决了这个。它也需要改变device_ioctl功能的签名。有没有inode的参数,也是函数应返回长。就像在以下修补程序:

Uhm, I solved this. It is also required to change signature of device_ioctl function. There is no inode parameter, and also the function should return long. Just like in following patch:

-static int st_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd_in, unsigned long arg)
+static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg)
{

(来源:<一个href=\"http://linux.derkeiler.com/Mailing-Lists/Kernel/2008-01/msg06799.html\">http://linux.derkeiler.com/Mailing-Lists/Kernel/2008-01/msg06799.html)

这篇关于unlocked_ioctl与正常的ioctl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆