Hi. For academic work, i have to add a dummy sytem call to the linux kernel. In classes they only explain how to do it for 2.4, but in 2.6 isn't the same, since the system call table isn't exported anymore.
I can (and in fact, I've already) add an in-kernel syscall (modifiying the entry.S for each arch, etc), but I'd like to be able to do it as a module, since recompiling and rebooting every change i made simply sux.
Any tips on how can i export the system call table and how can i add a syscall to it?
wrapper?
Why don't you just make a wrapper syscall, i.e. put something like
long (*my_syscall)(args...) = NULL; EXPORT_SYMBOL(my_syscall); asmlinkage long sys_my_syscall(args...) { return my_syscall ? my_syscall(args) : -ENOSYS; }into a builtin object and entry.S and assign the function pointer in the module? For debugging this seem adequate.
x)))
that seemed to work!! Thank you very much!!
How system call module really implement?
Apt-drink.. I ran into the same problem but I don't know how to start doing that. Please give me some suggestion.
Thank you
Hello,
Hello,
I am a newbie and I am supposed to do the same thing but I am not able to understand it. Can you please tell me if what I understand is right?
I modify syscall_table.S to add entry corresponding to 'wrapper' system call ('my_syscall'). And make a module which defines sys_my_syscall as you have shown.
long (*my_syscall)(args...) = NULL;
EXPORT_SYMBOL(my_syscall);
asmlinkage long sys_my_syscall(args...)
{
return my_syscall ? my_syscall(args) : -ENOSYS;
}
I define another module which implements system call say 'my_front_syscall' (which will be invoked from user space) and define sys_my_front_syscall such that it calls sys_my_syscall module, setting 'my_syscall' to address of function that does actual 'action-carrying' part defined in 'my_front_syscall'.
You got most of it right. Onl
You got most of it right. Only change is you just have to implement 'my_front_syscall' and assign my_syscall pointer to this function. From user space you still use my_syscall. you dont need sys_my_front_syscall.