Friday, August 20, 2010

Voyage to Linux Kernel Day 12 program errors

I am trying the program from Linux For You magazine Day 12 of Voyage to Linux Kernel
June 2009 edition.
From Aasis Vinayaks column following is the program on my Ubuntu laptop


#include
#include
#include
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;
}

Has given a lot of errors discussed on Kernel Newbies mailing list.
Here
http://www.spinics.net/lists/newbies/msg39896.html
Seems to have been the longest discussion in the history of Linux Kernel Newbies mailing list.
Please do suggest if you feel any correction is needed in the program.

No comments: