我想使用 ioctl 与我的内核模块进行通信。我已经编写了两个 c 程序,一个用于内核模块,另一个用于用户模式。编译内核模块时出现此错误:
错误:在初始化程序中指定了未知字段“ioctl”
在这一行:
struct file_operations Fops = {
.read = device_read,
.write = device_write,
.ioctl = device_ioctl, ------> at this point error is occuring.
.open = device_open,
.release = device_release,
};
知道为什么会这样。
谢谢
最佳答案
在较新的内核中,首选方法是使用 .unlocked_ioctl
或 .compat_ioctl
字段。平原 .ioctl
已从 struct file_operations
中删除. This discussion可能会澄清发生了什么以及如何处理。
关于ubuntu-10.04 - 在内核模式和用户模式之间使用ioctl通信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5868908/