【问题标题】:Getting error: implicit declaration of function 'proc_create'出现错误:函数“proc_create”的隐式声明
【发布时间】:2013-10-26 18:35:00
【问题描述】:

我在编译我的驱动程序模块时收到“函数 'proc_create' 的隐式声明”错误。我想在 /proc 中创建一个条目并打印正在使用该模块的程序的数量。你能告诉我这里有什么问题吗?这是我的代码。

#include<linux/module.h>
#include<linux/fs.h>

#define HELLO_MAJOR 234
static int debug_enable = 0;
static int no_of_access;
module_param(debug_enable, int, 0);
MODULE_PARM_DESC(debug_enable, "Enable module debug mode.");
struct file_operations hello_fops;
struct proc_dir_entry *proc_file_entry;

<File operation functions...>
<Incremented global_counter in the file open operation.>

static int hello1_read_proc(char *buf, char **start, off_t offset,
                            int count, int *eof, void *data)
{
    int len=0;
    len += sprintf(buf+len, no_of_access);
    *eof=1;
    return len;

}

static int __init hello_init(void)
{
    int ret;
    proc_file_entry = proc_create("examples/hello1", 0,NULL, hello1_read_proc);
    if(proc_file_entry == NULL)
            return -ENOMEM;
    printk("\nProc file entry for hello1 has been created !!!\n");

}

static void __exit hello_exit(void)
{
    printk("Hello Example Exit\n");
    remove_proc_entry("exmaples/hello1", NULL);
    unregister_chrdev(HELLO_MAJOR,"hello1");
 }

提前致谢。

【问题讨论】:

    标签: linux linux-kernel linux-device-driver


    【解决方案1】:

    您还需要包含&lt;linux/proc_fs.h&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-27
      • 2013-03-20
      • 2018-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多