I'd like to add a new system call via an LKM, but I'm not sure how to do this. That is, I know that if I want to add a completely new system call, I can look through the sys_call_table and find a sys_ni_syscall
and just replace it, but I was curious if it was possible to actually add to the sys_call_table
. I realize it's probably not possible, given that it's a fixed size array, but I was wondering if there were any other clever ways to add system calls without overriding an unused system call number.
views:
454answers:
2
+1
A:
Check The Linux Documentation Project website for "The Linux Kernel Module Programming Guide" (http://www.tldp.org/LDP/lkmpg/2.6/html/index.html). Specifically, look here for System Calls: http://www.tldp.org/LDP/lkmpg/2.6/html/x978.html. That should give you a start, at least.
Shannon Nelson
2009-01-21 05:04:51
Read through that, although it looks like sys_call_table is no longer exported in the 2.6 kernel. See the comment in syscall.c
FreeMemory
2009-01-21 14:25:15
+1
A:
Here's an example
linux system calls
edit:
The example above shows howto implement a system call, as far as implementing one from a loadable module; AFAIK, that's not possible, unless you where to overwrite an existing one because the size of the array is a #define.
Keep in mind there are user space changes required as well, at least if you want to be able to actually use the new system call.
Steve Lazaridis
2009-01-21 06:03:54