> Anyone tell me how to add new system call to linux
> without recompiling linux kernel?
Its multifasceted issue,
First of all, sys_call table is no longer exported since somewhere in
2.5 series, so you can't add a new syscall without actually compiling
the kernel atleast once.
The reason being that syscall table manulpulation would mean a huge
code in that area to ensure atomicity of such operations and will mean
a huge performance hit as well as maintainability reduciton.
Also by default Linux strives to maintain userland API compatibility.
Adding or changing syscall table is not just discouraged, but is
completely against the basic philosophy of the kernel.
There are two solutions to the situation,
1.
The introduction of /proc file system was exactly to remove the need
to have modules add new syscalls.
Its the prefered interface to userland for all new kernel modules. You
can mostly accomplish all the tasks through /proc.
If you really want to add a syscall which is for general purpose use
by userland apps, by design it should be compiled inside the kernel.
The base philosophy for linux is that, the tried and tested everything
is a file concept is enough for almost everything, barring a few
things like kernel parameters. And any new syscall will have to be
scrutinised for years before its accomodated. Otherwise applications
will start adding their own calls to kernel and it will be
maintainability nightmare, more or less like the windows is now today
with undocumented syscalls added in and out for specific applications.
2.
You can modify entry.S and add a dummy syscall which calls some hypothetical
function, and then your module can fill in the pointer at load time.
Like this,
long (*my_syscall)(args...) = NULL;
EXPORT_SYMBOL(my_syscall);
asmlinkage long sys_my_syscall(args...)
{
return my_syscall ? my_syscall(args) : -ENOSYS;
}
Downside is that you can't expect it to work with other people unless
they patch their kernel.
Well apart from this, there is usually char interface with IOCTL that
can be used as an private alternative to syscall.
--
BAIN
http://abhijit.adotout.net
--
______________________________________________________________________
Pune GNU/Linux Users Group Mailing List: ([email protected])
List Information: http://plug.org.in/mailing-list/listinfo/plug-mail
Send 'help' to [EMAIL PROTECTED] for mailing instructions.