[RndTbl] syscall mapping in userland.
sean at tinfoilhat.ca
Mon Mar 12 01:29:53 CDT 2007
I'm implementing a basic system call to get a handle on how.
Now I build it into a kernel fine and call it via 'syscall
(__NR_foo)'; which gives the desired output.
Now I'm trying to get the stub working so I can call in userland via
Since when compiling the kernel my foo.h wasn't put in /usr/include/
linux/foo.h I copied it there myself.
The contents are below:
_syscall0(int,foo); /* no parameters. */
Now if I complile a test userland app trying to reference foo.h I get.
gcc -o t test.c
In file included from test.c:2:
/usr/include/linux/foo.h: error: expected declaration specifiers or
'...' before 'foo'
/usr/include/linux/foo.h: warning: data definition has no type or
This lends me to believe that either I'm using _syscall0 wrong or it
is broken (since I can invoke the system call by it's number). I've
grepped through the kernel source and found lots of references
(specifically x64 ones) for stub_syscallX but nothing matching what
has been described (aside from the macro definitions of course).
I've also ready through syscall(2) man page and it states I'm using
it right as does the macro itself in include/asm/unistd.h I've also
tried going around the macro by doing it manually (ie. implement the
macro with my values instead of the 'macro parameters').
Does anyone see anything obviously wrong with the above or have any
links to relevant documents that detail syscall creation on a kernel
newer than 2.4 (lots I've found so far are 2.4 centric and there have
been significant layout changes since)?
More information about the Roundtable