On 5/9/06, Manish Regmi <regmi.manish@xxxxxxxxx> wrote:
On 5/9/06, pradeep singh <2500.pradeep@xxxxxxxxx> wrote: Since, current is an inline function returning struct task_struct *, it should work fine. For your error message it seems that sched.h and/or asm/current.h is not included? Did you include <asm/current.h> and <sched.h>? :)
You are right i included <linux/sched.h> but not <asm/current.h> :( Now it compiles all right. But there is still few doubts. Why didn't the same code compile with including just <linux/sched.h> and not <asm.current.h> when i use code like this -> #include <linux/module.h> #include <linux/init.h> #include <linux/sched.h> MODULE_LICENSE("GPL"); static int __init init(void) { struct task_struct *p; p = current; printk(KERN_DEBUG "%u", p->pid); <- gives error on this line. return 0; } static void __exit exit(void) { printk(KERN_DEBUG "\nCurrent process is now in exit as %u", current->pid); } module_init(init); module_exit(exit); on the other hand if i use printk(KERN_DEBUG "%u", current->pid); in the offending line i can compile it wihtout any hiccups, why? Second doubt dmesg shows me pid of the current process during insmod as 2445. but when i rmmod the module it has changed to 2445<7> why? why is it not showing the KERN_DEBUG priority before also.On the second thoughts why is <7> there at all? Any links or pointers? Thank you Pradeep -- play the game -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/