什么是create_proc_entry()的替代方法 [英] What is alternative of create_proc_entry()

查看:133
本文介绍了什么是create_proc_entry()的替代方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于不推荐使用create_proc_entry函数,它的替代品是什么? 我试图使用create_proc_entry创建一个简单的proc条目,但收到此错误:

错误:函数"create_proc_entry"的隐式声明

我在proc_fs.h中添加了create_proc_entry,但没有在其中找到它.有什么我想念的东西吗?或者有其他选择可以做到这一点?

解决方案

较新的函数名为proc_*.您可以在 include/linux/proc_fs.h 中看到它们的声明. /p>

尤其是proc_create创建一个proc条目.您可以在 fs/proc/generic.c .您可能对 proc_mkdir 特别感兴趣和 proc_create_data .


给将来的访问者的注意事项:请记住这篇文章的日期.这些链接指向Linux的master分支,该分支可能会随着时间而变化.如果您需要旧版本的界面,则可以找到先前提交的等效位置.如果您需要最新版本,则此答案中的建议可能已过时.

As create_proc_entry function is deprecated, what is its replacement? I was trying to create a simple proc entry using create_proc_entry but got the this error:

error: implicit declaration of function ‘create_proc_entry’

I grepped create_proc_entry in proc_fs.h but didn't find it there. Is there something that I'm missing or there's alternative to do this?

解决方案

The newer functions are named proc_*. You can see their declarations in include/linux/proc_fs.h.

In particular, proc_create creates a proc entry. You can check out the implementation of the other (quite useful) functions in the source file at fs/proc/generic.c. You may be particularly interested in proc_mkdir and proc_create_data.


Note to future visitors: Please keep the date of this post in mind. The links are to the master branch of Linux, which could change over time. If you need the interface for an older version, you can find the equivalent location for a previous commit. If you want the latest version, the suggestions in this answer could have become outdated.

这篇关于什么是create_proc_entry()的替代方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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