问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/18565381/what-is-alternative-of-create-proc-entry