On Tue, Jul 31, 2007 at 01:32:29PM +1000, Amos Shapira wrote:
> Hello,
> 
> Is it possible to dynamically add a system call (e.g. by a kernel
> module)?

No.

> As far as I'm familiar with the kernel internals I'd say that the
> answer is "no" but just in case I missed something I would like to
> hear from the experts.
> 
> I know that system calls are identified by numbers which are
> basically indexes into the sys_call_table array which seems to be
> compiled statically with the kernel source, and I can't find
> anywhere any internal kernel API which changes this table.

Correct so far.

> The goal of this is that I'd like to add a way to do kernel-level
> operation (e.g. given a file name, do a special filesystem operation
> on it) which is most natural to do by inventing a new system call.

> I don't expect my code to get integrated into the kernel (not at
> initial stage, at least) but I'd still like to make it possible for
> users to say "uhh ohh, I'd like to make this operation now, without
> having to reboot to a special kernel" and be able to
> download/compile/install a kernel module which will enable this
> operation.  There is no way to do this operation any other way than
> to add some kernel-level code (there is no way to achieve this
> through existing system calls or other kernel code).
> 
> Currently my plan is to add a special file under /proc or /dev which
> any program will be able to open and then pass the arguments through
> ioctl(2).

That's (one of) the usual ways of doing it. Note that only a subset of
the operations available in the kernel are exported to modules - if
what you want to do is "interesting enough", you may want to consider
doing it as a patch to the kernel and avoiding external modules.

Remember kids, "external modules are second class citizens".

Cheers,
Muli

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to