在内核模式和用户模式之间使用ioctl通信

Dal*_*nd 17 ioctl kernel-module ubuntu-10.04

我想使用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,
};
Run Code Online (Sandbox Code Playgroud)

知道为什么会这样.

谢谢

Eug*_*ene 23

在较新的内核中,首选方法是使用.unlocked_ioctl.compat_ioctl字段.平原.ioctl被移除了struct file_operations.这个讨论可能会澄清发生了什么以及如何处理.