函数'create_proc_entry'的隐式声明 [英] implicit declaration of function 'create_proc_entry'

查看:577
本文介绍了函数'create_proc_entry'的隐式声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用create_proc_entry()函数在/proc下创建目录.当我尝试编译代码时,出现以下错误:函数'create_proc_entry'的隐式声明.

I'm trying to use the create_proc_entry() function to create a directory under /proc. When I try to compile the code, I get the following error: implicit declaration of function 'create_proc_entry' .

这些是我包含在.c文件中的标头:

These are the headers I have included in my .c file:

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/string.h>
#include <linux/vmalloc.h>
#include <linux/uaccess.h>

我要编译的机器上的内核版本是:3.10.33-g7954807-dirty

The kernel version on the machine I'm trying to compile for is: 3.10.33-g7954807-dirty

我是否缺少调用此方法所需的任何标头?还是在我的内核版本中不赞成使用该方法?

Am i missing any headers necessary to call this method? Or is the method deprecated in my version of the kernel?

推荐答案

/proc文件系统已在3.10中重构,正在查找的功能已被删除,您应该使用功能齐全的proc_create函数家族.请注意,签名是不同的.

/proc filesystem has been refactored in 3.10, the function you are looking for has been removed, you should use the full featured proc_create function family. Note that the signatures are different.

3.10版本: http://lxr.free-electrons.com/source/include/linux/proc_fs.h?v = 3.10

3.9版本: http://lxr.free-electrons.com/source/include/linux/proc_fs.h?v = 3.9

您可以在《 Linux设备驱动程序4》一书中找到有关使用功能齐全的/proc功能的更多说明,或者,如果需要更短的解决方案,请查看此链接(

You can find greater explanation of using full featured /proc functions in the book Linux Device Drivers 4, or, if you want shorter solution, check this link (https://github.com/jesstess/ldd4/blob/master/scull/main.c) where you can see how the struct file_operations has been used. You do not have to setup to all fields of the struct.

这篇关于函数'create_proc_entry'的隐式声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆