i received the following error compiling my new kernel module in RHEl 4:
my code follows:
//#define MODULE
//#define __KERNEL__
#include<linux/kernel.h>
#include<linux/module.h>
/*#if CONFIG_MODVERSIONS == 1
#define MODVERSIONS
#include<linux/modversions.h>
#endif*/
#include<linux/sys.h>
#include<sys/syscall.h>
//#include<sys/time.h>
/***for tracing user and process******/
//#include<linux/sched.h>
extern void *sys_call_table[NR_syscalls];
int(*orig_sys_call)(const char *, int, int);
asmlinkage int(*get_uid)();
asmlinkage int(*get_time_of_day)(struct timeval *, struct timezone *);
/****fn trapping open*********/
int my_sys_open(const char*filename, int flags, int mode)
{
int i;
//struct timeval *x;
//struct timezone *y;
//time_t secs;
//i = get_uid();
//get_time_of_day(x,y);
//secs = x->tv_sec;
printk("process tries to call the system call open at time ");
return orig_sys_call(filename, flags, mode);
}
/******appending our actions to the origcall*******/
int init_modle()
{
orig_sys_call = sys_call_table[__NR_open];
sys_call_table[__NR_open] = my_sys_open;
get_uid = sys_call_table[__NR_getuid];
get_time_of_day = sys_call_table[__NR_gettimeofday];
return 0;
}
void cleanup_module()
{
sys_call_table[__NR_open] = orig_sys_call;
}
after compilation, i get the error"undefined symbol sys_call_table"
is this a prolem for 2.6 kernels?
any solutions please?