Error: implicit function declaration 'create_proc_read_entry' [-Werror = implicit-function-declaration]

I try to compile the kernel module in kernel 3.13 and I get this error:

error: implicit declaration of function 'create_proc_read_entry' [-Werror=implicit-function-declaration] 

I google and did not find the answer. Here is the piece of code that relates to this error:

 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) proc = proc_net_create(KAODV_QUEUE_PROC_FS_NAME, 0, kaodv_queue_get_info); #else proc = create_proc_read_entry(KAODV_QUEUE_PROC_FS_NAME, 0, init_net.proc_net, kaodv_queue_get_info, NULL); #endif if (!proc) { printk(KERN_ERR "kaodv_queue: failed to create proc entry\n"); return -1; } 

Can i get help? I really don't know what is wrong. This may be the 3.13 kernel that needs the patch. I read somewhere (on KERNEL 3.10) that the kernel needs a patch. Can someone show me where I can get the kernel 3.13 patch to ultimately solve the problem. Thanks

+7
c linux linux-kernel kernel-module
source share
3 answers

The error is that you are not explicitly including the header declaring the function, and the compiler is β€œimplicit” for you, and this raises a warning. The '-Werror' flag causes the compiler to treat the warning as an error. Try adding: #include <linux/proc_fs.h>

Also: create_proc_read_entry is an obsolete function.

Take a look at: https://lkml.org/lkml/2013/4/11/215

+6
source share

on Linux 3.9

 static inline struct proc_dir_entry *create_proc_read_entry(const char *name, umode_t mode, struct proc_dir_entry *base, read_proc_t *read_proc, void * data ) { return NULL; } 

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

on Linux 3.10

 static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct file_operations *proc_fops ) 

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

So, change create_proc_read_entry() to proc_create() and change 5 parameters to 4 parameters. Then it works.

+1
source share

On your linux version 3.13 create_proc_read_entry this method has been removed, use proc_create or proc_create_data strong> instead . You can use this API

 struct proc_dir_entry *proc_create_data(const char *, umode_t, struct proc_dir_entry *, const struct file_operations *, void *); static inline struct proc_dir_entry *proc_create( const char *name, umode_t mode, struct proc_dir_entry *parent, const struct file_operations *proc_fops); 
0
source share

All Articles