不能再简化了

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

#include<linux/proc_fs.h>

int meng_read_proc(char*page,char**start,off_t offset,int count,int*eof,void*data)
{
        char*s="Hello. This is meng proc file.\n";
        strcpy(page,s);
        *eof=1;
        return strlen(s);
}

int init_meng_proc(void)
{
        create_proc_read_entry("mengproc",0,NULL,meng_read_proc,NULL);
        return 0;
}
void exit_meng_proc(void)
{
        remove_proc_entry("mengproc",NULL);
}
module_init(init_meng_proc);
module_exit(exit_meng_proc);

 

posted on 2014-05-22 17:14  宇睿  阅读(190)  评论(0编辑  收藏  举报