发新话题
打印

unresolved synbol proc_register?怎么办?

unresolved synbol proc_register?怎么办?

生成.o文件,但insmod的时候出现unresolved synbol proc_register,unresolved symbol proc_unregister.
这怎么解决?
我的程序:
#ifndef __KERNEL__
#define __KERNEL__
#include <linux/proc_fs.h>
#include <asm/uaccess.h>
#include <linux/fs.h>
#undef __KERNEL__
#endif
static ssize_t test_output(struct file * file,
char *buf,
size_t len,
loff_t *offset)
{
char buff[20];
strcpy(buff,"in output copy_to_user");
copy_to_user(buf,buff,sizeof(buff));
return 0;
}

ssize_t test_input(struct file *file,
char * buf,
size_t len,
loff_t *offset)
{
char buff[20];
strcpy(buff,"in input copy_to_user");
copy_from_user(buff,buf,sizeof(buff));
return 0;
}

int test_open(struct inode* inode,struct file *file){
return 0;
}

int test_close(struct inode* inode,struct file *file){
return 0;
}

static struct file_operations file_test = {
NULL,
test_output,
test_input,
NULL,
NULL,
NULL,
NULL,
test_open,
NULL,
test_close,
};


static struct inode_operations inodetest = {
&file_test,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
};

static struct proc_dir_entry procfile = {
0,
4,
"test",
S_IFREG|S_IRUSR|S_IWUSR,1,0,0,
80,
NULL,
&inodetest,
NULL
};



int init_module(){
printk("hello in kernel!\n");
return proc_register(&proc_root,&procfile);
}

void cleanup_module(){
printk("leave and unregisiter!\n");
proc_unregister(&proc_root,&procfile);
}


      

TOP

cat /proc/ksyms | grep proc_register
看看有没有输出,没有就说明内核里没这函数      

TOP

发新话题