我正在尝试制作一个简单的 procfs 模块,但出现此错误:
error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
Run Code Online (Sandbox Code Playgroud)
我尝试了许多在线示例,但收到相同的错误消息。
您必须proc_ops在较新的内核中使用而不是file_operations,请参阅https://lore.kernel.org/linux-fsdevel/20191225172228.GA13378@avx2/:
static struct proc_ops my_fops={
.proc_open = my_proc_open,
.proc_release = single_release,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = my_proc_write
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2123 次 |
| 最近记录: |