Adding a dummy system call
Hi Everyone, I am trying to learn the linux kernel via the book Linux Kernel Development 3rd edition by Robert Love, and in it he advises to use the macro _syscallX to allow access to user added syscalls not wrapped by glibc functions. In my attempt to add a system call this macro failed me and after a little man page perusal I noticed _syscallX is obselete. Is it considered a better practice to declare the asmlinkage int sys_X(..) declaration myself instead of using this obsolete macro? Or did syscall(2) replace it? And if it was replaced does anyone have a reference they could point me for adding system calls in kernel 3.10 or similar? thank you in advance!
Check out SYSCALL_DEFINEx series of macros: http://lxr.free-electrons.com/source/include/linux/syscalls.h#L171 Is this what you're looking for? Vitor.
On Fri, Apr 4, 2014 at 9:20 PM, Adam Fowler <ajf2177@columbia.edu> wrote:
Hi Everyone, I am trying to learn the linux kernel via the book Linux Kernel Development 3rd edition by Robert Love, and in it he advises to use the macro _syscallX to allow access to user added syscalls not wrapped by glibc functions. In my attempt to add a system call this macro failed me and after a little man page perusal I noticed _syscallX is obselete. Is it considered a better practice to declare the asmlinkage int sys_X(..) declaration myself instead of using this obsolete macro? Or did syscall(2) replace it? And if it was replaced does anyone have a reference they could point me for adding system calls in kernel 3.10 or similar? thank you in advance!
Hi, To call a new/generic syscall in userspace, take a look here: http://www.gnu.org/software/libc/manual/html_node/System-Calls.html To add a new syscall to a recent kernel, take a look here: http://blog.techveda.org/adding-system-calls-linux-kernel-3-5-x/ -- Augusto Mecking Caringi
Thank you both these will all be very helpful! Cheers! On Apr 4, 2014 11:11 PM, "Augusto Mecking Caringi" <augustocaringi@gmail.com> wrote:
On Fri, Apr 4, 2014 at 9:20 PM, Adam Fowler <ajf2177@columbia.edu> wrote:
Hi Everyone, I am trying to learn the linux kernel via the book Linux Kernel Development 3rd edition by Robert Love, and in it he advises to use the macro _syscallX to allow access to user added syscalls not wrapped by glibc functions. In my attempt to add a system call this macro failed me and after a little man page perusal I noticed _syscallX is obselete. Is it considered a better practice to declare the asmlinkage int sys_X(..) declaration myself instead of using this obsolete macro? Or did syscall(2) replace it? And if it was replaced does anyone have a reference they could point me for adding system calls in kernel 3.10 or similar? thank you in advance!
Hi,
To call a new/generic syscall in userspace, take a look here:
http://www.gnu.org/software/libc/manual/html_node/System-Calls.html
To add a new syscall to a recent kernel, take a look here:
http://blog.techveda.org/adding-system-calls-linux-kernel-3-5-x/
-- Augusto Mecking Caringi
participants (3)
-
Adam Fowler -
Augusto Mecking Caringi -
Vitor Braga