【问题标题】:Using ioctl communication between Kernel mode and user mode在内核模式和用户模式之间使用ioctl通信
【发布时间】:2023-03-15 16:00:01
【问题描述】:

我想使用 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,
};

知道为什么会这样。

谢谢

【问题讨论】:

    标签: ubuntu-10.04 kernel-module ioctl


    【解决方案1】:

    在较新的内核中,首选方法是使用.unlocked_ioctl.compat_ioctl 字段。普通的.ioctl 已从struct file_operations 中删除。 This discussion 可能会澄清发生了什么以及如何处理。

    【讨论】:

      【解决方案2】:

      在较新的内核中,使用.unlocked_ioctl 代替.ioctl。它工作正常。

      【讨论】:

        猜你喜欢
        • 2011-06-23
        • 1970-01-01
        • 2019-07-27
        • 2015-12-12
        • 2012-12-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多