这是我加载模块时的函数
static int __init readprocess_init(void){
example_dir = proc_mkdir("readprocess",NULL);
example_dir->owner = THIS_MODULE;
process_file = create_proc_read_entry("processfile",0666,example_dir,proc_read_process,NULL);
process_file->owner = THIS_MODULE;
return 0;
}
这是我的读函数
int proc_read_process(char *page,char **start,off_t off,int count,int *eof,void *data){
int len;
len = sprintf(page,"I am SB");
return len;
}
make之后,insmod *.ko文件,/proc/下有readprocess目录,目录下也有processfile文件,可是cat processfile文件却不执行它的读函数
,搞不懂它为何这么傲娇

static int __init readprocess_init(void){
example_dir = proc_mkdir("readprocess",NULL);
example_dir->owner = THIS_MODULE;
process_file = create_proc_read_entry("processfile",0666,example_dir,proc_read_process,NULL);
process_file->owner = THIS_MODULE;
return 0;
}
这是我的读函数

int proc_read_process(char *page,char **start,off_t off,int count,int *eof,void *data){
int len;
len = sprintf(page,"I am SB");
return len;
}
make之后,insmod *.ko文件,/proc/下有readprocess目录,目录下也有processfile文件,可是cat processfile文件却不执行它的读函数

