Re: Enabling and disabling system calls



Rafael Almeida wrote:
I understand how to create a new entry to Kconfig that would make my
system call be compiled into the kernel or not. I know even how to make
the Makefile not compile the mysyscall.c if the option is not selected.

Okay, so you presumably have some CONFIG_MYSYSCALL symbol, right? In
the Makefile, instead of using obj-y, you use obj-$(CONFIG_MYSYSCALL).

But my problem is that the system call is still declared on the
syscall_table.S file.

You can use #ifdef CONFIG_MYSYSCALL to conditionalize the definition of
_NR_syscall, and conditionally define the table entry.

Is that what you are asking? Or are you asking how the compiler in user
space can see a declaration of the system call so that an application
can be compiled and linked to use it?

Am I missing something?

Yes, that people should not be randomly adding system calls to the
kernel. It's not easy to do for a good reason.

There is no completely reliable way for a user space application to
tell whether it's talking to the same nonstandard system call that it
/thinks/ it is talking to.

In the next version of the kernel, the number that you picked might be
taken over. So now your user-space application has to detect which
kernel it is running on and use different numbers.

Another issue is that the assembly language sycall_table is machine
dependent. You have only added your system call for one architecture.
If the kernel is compiled for a different architecture, your system
call won't be wired in.

So it's best not to extend the kernel this way---unless you take on the
chore of maintaining your own Linux distribution. Instead, consider,
for instance, making a character device. Then you can have your own
ioctls which easily port from one kernel version to the next without
conflicting with anything and having to be renumbered. The kernel
doesn't even have to be recompiled, since your device can build outside
of the tree as a loadable module.

.



Relevant Pages

  • Re: Kbuild Makefile output
    ... Now I have created single makefile to compile all this ... But now the problem is lots of file included in kernel ... Previously in 2.4 we use to put all output object file ...
    (Linux-Kernel)
  • Re: Compiling ftape modules
    ... >suitable Makefile for the temp directory. ... Then I created the ftape directory ... This is very similar to what was happening when I was trying to compile "in ... modules and the kernel as installed in the FC3 release? ...
    (Fedora)
  • Re: Distributions
    ... | general there are a lot of packages for people to use. ... kernel, have to run on a multitude of different systems, they tend to be ... and slower than if you compile those packages, ... can have that stability with virtually any distro. ...
    (Debian-User)
  • Re: Distributions
    ... Ubuntu is based on Debian, ... | general there are a lot of packages for people to use. ... kernel, have to run on a multitude of different systems, they tend to be larger ... and slower than if you compile those packages, ...
    (Debian-User)
  • Problems with custom kernel fbsd 6.2
    ... My kernel for freebsd 6.2 is not compiling but only with my custom config. ... I was able to compile it with the GENERIC kernel included, but my modified one will not compile. ... # Power management support ...
    (freebsd-questions)