Ok I did try what you suggested. From http://tldp.org/LDP/lkmpg/2.6/html/x181.html#AEN189 here is my Makefile obj-m += sample2.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean but I got same errors tapas@tapas-laptop:~/LKP/pandora/temp/sample2$ make make -C /lib/modules/2.6.28-11-generic/build M=/home/tapas/LKP/pandora/temp/sample2 modules make[1]: Entering directory `/usr/src/linux-headers-2.6.28-11-generic' CC [M] /home/tapas/LKP/pandora/temp/sample2/sample2.o /home/tapas/LKP/pandora/temp/sample2/sample2.c:2:25: error: sys/syscall.h: No such file or directory /home/tapas/LKP/pandora/temp/sample2/sample2.c: In function ‘init_module’: /home/tapas/LKP/pandora/temp/sample2/sample2.c:14: error: ‘__NR_exit’ undeclared (first use in this function) /home/tapas/LKP/pandora/temp/sample2/sample2.c:14: error: (Each undeclared identifier is reported only once /home/tapas/LKP/pandora/temp/sample2/sample2.c:14: error: for each function it appears in.) /home/tapas/LKP/pandora/temp/sample2/sample2.c: In function ‘cleanup_module’: /home/tapas/LKP/pandora/temp/sample2/sample2.c:19: error: ‘__NR_exit’ undeclared (first use in this function) make[2]: *** [/home/tapas/LKP/pandora/temp/sample2/sample2.o] Error 1 make[1]: *** [_module_/home/tapas/LKP/pandora/temp/sample2] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-2.6.28-11-generic' make: *** [all] Error 2 Following is the program for which it was Makefile I am mentioning it here for the sake of clarity so that you dont have to read first post #include <linux/kernel.h> #include <sys/syscall.h> #include <linux/module.h> extern void *sys_table[]; asmlinkage int(*main_sys_exit)(int); asmlinkage int alt_exit_function(int err_code) { printk("Sys_exit called with err_code=%d\n",err_code); return main_sys_exit(err_code); } int init_module() { main_sys_exit=sys_table[__NR_exit]; sys_table[__NR_exit]=alt_exit_function; } void cleanup_module() { sys_table[__NR_exit]=main_sys_exit; } ~ -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ