#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sys.h>
#include <stdio.h>
 
extern void *sys_call_table[];
 
asmlinkage static void sys_my_func();
 
void *old_val;

 
int
init_module()
{
        printk("Adding my own system call \n");
	old_val = (void *) sys_call_table[250];
 
        sys_call_table[250] = (void *) sys_my_func;
 
        return 0;
}
 
asmlinkage static void sys_my_func()
{
        printk("I am a working system call.\n");
}
 
void
cleanup_module()
{
        sys_call_table[250] = old_val;
	printk("<1> Restoring sys_call_table\n");
}
