No It did not worked I tried what you said.
Here is the new program.
If possible just copy paste the program and try to run.

#include <linux/kernel.h>
#include <asm/syscalls.h>
#include <linux/module.h>
#include <linux/unistd.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;
}


Following way I tried to do it.

gcc -I /usr/src/linux-headers-`uname -r`/include -I
/usr/src/linux-headers-`uname -r`/linux -Wall -DMODULE -D__KERNEL__
-DLINUX -c sample2.c

and following errors I got

http://pastebin.com/ZGRD8cC3
any more guess?

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to