Re: Enabling and disabling system calls
- From: "Kaz Kylheku" <kkylheku@xxxxxxxxx>
- Date: 30 Oct 2006 23:09:53 -0800
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.
.
- References:
- Enabling and disabling system calls
- From: Rafael Almeida
- Enabling and disabling system calls
- Prev by Date: how to build a single boot CD/DVD supporting x86 and IPF(ia64) in linux
- Next by Date: Re: pci details for software writers
- Previous by thread: Enabling and disabling system calls
- Next by thread: how to build a single boot CD/DVD supporting x86 and IPF(ia64) in linux
- Index(es):
Relevant Pages
|