我正在用内核版本3.14.17编写一个简单的LSM代码。
代码片段:
#include <linux/module.h> // included for all kernel modules
#include <linux/kernel.h> // included for KERN_INFO
#include <linux/init.h> // included for __init and __exit macros
#include <linux/security.h>
#include <linux/trace
我在sudo apt-get upgrade上得到了以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
linux-headers-generic : Depends: linux-headers-4.4.0-151-gene
正如在这个问题中指出的,Linux内核模块中的ioctl函数的原型是:
(第1版)
int ioctl(struct inode *i, struct file *f, unsigned int cmd, unsigned long arg);
或
(第2版)
long ioctl(struct file *f, unsigned int cmd, unsigned long arg);
我想在实现字符设备驱动程序的内核模块中使用它们。
在这种情况下,上述两种原型是否都适合?如果是,为什么?如果没有,如何选择正确的?
哪些头/源文件(S)包含这些原型?换句话说:这些原型的官方参考文件是什么?
无论是通过更新管理器,还是通过终端,我都出错了。
当我尝试sudo apt-get update && sudo apt-get upgrade时:
Fetched 1,024 kB in 20s (51.0 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree Reading state information... Done
You might want to run 'apt-get -f install' to corr
我有一些linux驱动程序,我想把它从Linux2.4移植到3.0。在这段漫长的时间跨度中,ioctl (unlocked_ioctl now)的参数列表发生了一些变化:
-static int can_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+static long can_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
代码使用inode获取次要版本,并将其传递给其他一些命令。既然inod