unlocked_ioctl和compat_ioctl
参考:
https://www.cnblogs.com/super119/archive/2012/12/03/2799967.html
https://lwn.net/Articles/119652/
http://b8807053.pixnet.net/blog/post/3610561-ioctl%2cunlocked_ioctl%e5%92%8ccompat_ioctl
Linux内核中struct file_operations含有下面两个函数指针:
struct file_operations {
... ...
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会被调用到。如果没有实现compat_ioctl,那么32位的用户程序在64位的kernel上执行ioctl时会返回错误:Not a typewriter
2、如果是64位的用户程序运行在64位的kernel上,调用的是unlocked_ioctl,如果是32位的APP运行在32位的kernel上,调用的也是unlocked_ioctl
示例:
#ifdef CONFIG_COMPAT
static long debussy_compat_ioctl (struct file *filp, unsigned int cmd, unsigned long arg)
{
return debussy_ioctl(filp, cmd, (unsigned long)compat_ptr(arg));
}
#endif static const struct file_operations debussy_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = debussy_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = debussy_compat_ioctl,
#endif
};
完。
unlocked_ioctl和compat_ioctl的更多相关文章
- The difference among ioctl, unlocked_ioctl and compat_ioctl (RT)
Meta-answer: All the raw stuff happening to the Linux kernel goes through lkml (the Linux kernel mai ...
- ioctl,unlocked_ioctl 处理方法
kernel 2.6.35 及之前的版本中struct file_operations 一共有3个ioctl : ioctl,unlocked_ioctl和compat_ioctl 现在只有unloc ...
- 字符设备驱动之Led驱动学习记录
一.概述 Linux内核就是由各种驱动组成的,内核源码中大约有85%的各种渠道程序的代码.一般来说,编写Linux设备驱动大致流程如下: 1.查看原理图,数据手册,了解设备的操作方法. 2.在内核中找 ...
- [tty与uart]1.Linux中tty框架与uart框架之间的调用关系剖析
转自:http://developer.51cto.com/art/201209/357501_all.htm 目录 1.tty框架 2.uart框架 3.自底向上 4.自顶向下 5.关系图 在这期间 ...
- Android ashmem hacking
/********************************************************************** * Android ashmem hacking * 声 ...
- ARM-Linux S5PV210 UART驱动(5)----串口的open操作(tty_open、uart_open)
串口驱动初始化后,串口作为字符驱动也已经注册到系统了,/dev目录下也有设备文件节点了. 那接下来uart的操作是如何进行的呢? 操作硬件之前都是要先open设备,先来分析下这里的open函数具体做了 ...
- ARM-Linux S5PV210 UART驱动(2)---- 终端设备驱动
在Linux中,UART串口驱动完全遵循tty驱动的框架结构,但是进行了底层操作的再次封装,所以先介绍tty终端设备驱动. 一.终端设备 1.串行端口终端(/dev/ttySACn) 2.伪终端(/d ...
- struct--file_operations
struct--file_operations----------------------------------------- struct file_operations是一个字符设备把驱动 ...
- file_operations结构体解析 1
注:学了这么长时间了,还没有好好看看 file_operations机构体,这其中还有很多的东西,当你学着学着的时候,就会用到这里面的一些系统调用对应的函数了,我在网上搜索之后,记录如下,一边将来查看 ...
随机推荐
- eclipse导入导出工作空间配置
首先,导出T1中的配置:打开T1,选择fileExport 在弹出框中选择General 下的preferencenext在export preferences 页面选择export all, 点Br ...
- wpf DataTemplate ColumnDefinition width equal
<Grid.ColumnDefinitions> <ColumnDefinition SharedSizeGroup="col1" /> <Colum ...
- Zookeeper集群搭建以及python操作zk
一.Zookeeper原理简介 ZooKeeper是一个开放源码的分布式应用程序协调服务,它包含一个简单的原语集,分布式应用程序可以基于它实现同步服务,配置维护和命名服务等. Zookeeper设计目 ...
- 阿里云对象存储 OSS,不使用主账号,使用子账号来访问存储内容
https://help.aliyun.com/document_detail/31932.html?spm=5176.doc31929.2.5.R7sEzr 这个示例从一个没有任何Bucket的阿里 ...
- Solr7.4.0的API(Solrj)操作
一.SolrJ的概念 solr单机版服务搭建:https://www.cnblogs.com/frankdeng/p/9615253.html solr集群版服务搭建:https://www.cnbl ...
- 插件bootstrap-table
基于Metronic的Bootstrap开发框架经验总结(16)-- 使用插件bootstrap-table实现表格记录的查询.分页.排序等处理 在业务系统开发中,对表格记录的查询.分页.排序等处理是 ...
- Win7建立FTP站点
Win7建立FTP站点 1.到控制面板---程序---打开或关闭windows功能,列表内找到 Internet信息服务(展开)---选中FTP的三个项: 2.到控制面板---系统和安全---管理工具 ...
- SpringBoot详细研究-05微服务与拾遗
这将是SpringBoot学习系列的最后一篇文章,主要涉及Spring Cloud和JHispter两个知识点,都具有一定综合性,需要多加实践加强理解. Spring Cloud 微服务Microse ...
- Redis高可用之集群配置(六)
0.Redis目录结构 1)Redis介绍及部署在CentOS7上(一) 2)Redis指令与数据结构(二) 3)Redis客户端连接以及持久化数据(三) 4)Redis高可用之主从复制实践(四) 5 ...
- AWT事件模型
1.什么是事件 1)事件------描述发生了什么的对象 [事件与异常类似,是由一个个类构成的,当一个事件产生的时候,实际上是由对应的那个事件的类来生成了一个对象,这个对象封装了与这个事件相关的信息, ...