HI ALL:<br> I just run a module on my machine, but it can't work. When the module run the kernel will painc. I don't know where is wrong. This is my code:<br><br> 1 #include<linux/module.h><br> 2 #include<linux/kernel.h><br>
3 #include<linux/init.h><br> 4 #include<linux/sched.h><br> 5 <br> 6 int input = 1;<br> 7 module_param (input, int, S_IRUGO);<br> 8 <br> 9 static int __init printvma_init (void)<br> 10 {<br> 11 struct vm_area_struct *p, *start;<br>
12 int i;<br> 13 struct task_struct *thread; <br> 14 <br> 15 thread = current;<br> 16 <br> 17 while (1)<br> 18 {<br> 19 if (thread->pid == input)<br>
20 break;<br> 21 thread = list_entry (thread->tasks.next, struct task_struct, tasks);<br> 22 }<br> 23 p = thread->mm->mmap;<br> 24 <br> 25 do{<br> 26 printk ("%lx\t%lx\t%s\n", p->vm_start,\<br>
27 p->vm_end, p->vm_file->f_path.dentry->d_iname);<br> 28 p = p->vm_next;<br> 29 }while (p != NULL);<br> 30 <br> 31 printk ("vm_file address is:%d\tf_path address is:%d\<br>
32 \tname is:%s",& p->vm_file->f_path,\<br> 33 p->vm_file->f_path.dentry->d_iname);<br> 34 <br> 35 printk ("info from the kernel space:%s\n", thread->comm);<br>
36 return 0;<br> 37 }<br> 38 <br> 39 static void __exit printvma_exit (void)<br> 40 {<br> 41 printk ("the module will leave the kernel space..\n");<br> 42 }<br> 43 <br> 44 module_init (printvma_init);<br>
45 module_exit (printvma_exit);<br> 46 MODULE_LICENSE ("GPL"); <br><br><br>what's wrong?<br><br>thanks<br>