ioctl返回-1解决方法
来源:互联网 发布:java怎么给字母排序 编辑:程序博客网 时间:2024/06/03 06:09
ioctl返回值为-1,明明很正常的一个驱动,在别的地方都能正常跑,居然有问题;一直百思不得其解,开内核log,居然没有执行到驱动设备Ioctl函数里面,第一时间想到的就是参数对不上,继续查找,发现没有问题,参数注册都正常,char驱动open\read\write接口都没有问题,居然只有这个ioctl有问题;继续跟踪file_operations结构,发现在这个结构中存在compat_ioctl,自从ioctl随着BKL退出历史的舞台之后,一直用到的是unlock_ioctl,这个compat_ioctl到底是干嘛的呢?本着对问题的研究精神,不放过任何一个可能性,我决定扒一扒compat_ioctl来历;
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
在./Documentation/filesystems/vfs.txt中有一段描述:compat_ioctl: called by the ioctl(2) system call when 32 bit system calls are used on 64 bit kernels.
正常的情况下,对Ioctl的调用,会走unlock_ioctl,但在32位系统64位的内核上面会走compat_ioctl接口,这就是compat_ioctl存在的意义,由于我使用的Android系统位32位,内核编译的是Arm64,这应该就是这个Bug产生的原因,果断替换位compat_ioctl,问题解决
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
在./Documentation/filesystems/vfs.txt中有一段描述:compat_ioctl: called by the ioctl(2) system call when 32 bit system calls are used on 64 bit kernels.
正常的情况下,对Ioctl的调用,会走unlock_ioctl,但在32位系统64位的内核上面会走compat_ioctl接口,这就是compat_ioctl存在的意义,由于我使用的Android系统位32位,内核编译的是Arm64,这应该就是这个Bug产生的原因,果断替换位compat_ioctl,问题解决
阅读全文
0 0
- ioctl返回-1解决方法
- Ioctl返回-1 出错,解决办法
- ioctl返回失败,驱动中ioctl没调问题解决
- 5--1 ioctl--幻数
- IOCTL助手 V1.1
- ioctl
- ioctl
- ioctl
- ioctl
- ioctl
- ioctl
- ioctl
- ioctl
- ioctl
- ioctl
- ioctl
- ioctl
- ioctl
- Android mvc,mvp , mvvm三种设计模式的选择实践
- Coursera deep learning 吴恩达 神经网络和深度学习 第四周 编程作业 Building your Deep Neural Network
- Servlet文件上传
- UE4场景太亮
- org.apache.hadoop.hive.serde2.SerDeException: Row is not a valid JSON Object
- ioctl返回-1解决方法
- Qt 坐标系统
- ue4 bp singleton
- Redis高可用方案哨兵机制------ 配置文件sentinel.conf详解
- Mycat使用性能监控管理工具获取相关性能缺陷和监视信息
- python中的注释行和注释块
- 2018医学考博英语阅读理解解题技巧
- 关于移动短信ISMG和SP的开发源码
- 编程中的降龙十八掌