It seems that as of kernel version 2.6.x (which x? does anybody know?) the macros _syscallX (where X=1,2,3,4,5,6) have been removed. Now what is a poor developer to do in order to get a system call to work?
I haven't been able to find a proper written document describing the "Novo ordo seclorum" of the kernel but what I did is simple and seems to work (compiling at least).
The _syscallX macros produced a wrapper function for the standard glibc function syscall(). This is what I did also but without the macro.
Let's say you want to use
int sys_foo(char* arg1,int arg2,struct bar* arg3).
Back in the old kernel days you whould put the following in your C source file:
_syscall3(int, sys_foo, char*, arg1, int, arg2, struct bar*, arg3) /* mind the comma's */
and you would use sys_foo normally as being defined in the same source file.
Observe to what this macro expands:
int sys_foo (char* arg1, int arg2, struct bar* arg3)
{
return syscall( __NR_sys_futex, arg1, arg2, arg3);
}
Case solved. Use the above function prototype as a guide and you will be rubbing your eyes*
(*) Direct greek translation of the expression "τρίβω τα μάτια μου". It is meant as a greek joke. All foreign speaking visitors please ignore and replace with "you will be astonished" or something similar.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment