2001-03-02 10:57:45

by T.L.Madhu

[permalink] [raw]
Subject: Info on adding system calls


Hi,

I want to add a function defined in my loadeble kernel module as system
call.
I know the procedure regarding how to add a system call permanently into
the kernel. But, doesn't know regarding how to add it for kernel loadable
module.

I will be thankful, if you can provide me any info/pointers.

Thanks,
Madhu




2001-03-06 21:37:29

by Peter Samuelson

[permalink] [raw]
Subject: Re: Info on adding system calls


[T.L.Madhu]
> I want to add a function defined in my loadeble kernel module as
> system call.

You can't. At least not without hackery -- anything is possible with a
bit of hackery.

And there are at least two good reasons for this. First: adding
syscalls at runtime is a recipe for chaos in terms of applications
knowing what the ABI should be. What if two modules wanted the same
unallocated syscall? Should the second one fail, or should it just get
a free syscall, and somehow publish its syscall to userspace so apps
can use it?

The second is philosophical. At the top of the COPYING file in the
kernel source, you see that Linus has made an exception to the GPL, to
allow anyone to write and distribute non-GPL modules, as long as they
do not compile directly into the kernel. However, he doesn't want
people to use this as a general GPL circumvention device, so he will
not make it convenient to extend the system call interface this way.

Peter