ive tried to implement a simple system call: (kernel version 2.6.16) i use FC4
in kernel/sys.c
asmlinkage long sys_soorejpid(void)
{
return current->pid;
}
in arch/i386/kernel/syscall_table.S, after line ".long sys_unshare" i add
.long sys_soorejpid
in include/asm/unistd.h, after the line "#define NR_syscalls 311" i add
#define __NR_soorejpid 312
compiled and loaded the new kernel.
i made a small C code to check it.
#define __NR_soorejpid 312
__syscall0(long,soorejpid)
#include <stdio.h>
main()
{
printf("%ld\n",soorejpid());
}
got a whole lot of errors.. im pasting first few errors here:
syscall.c:2: error: syntax error before 'soorejpid'
In file included from /usr/include/stdio.h:34,
from syscall.c:3:
/usr/lib/gcc/i386-redhat-linux/4.0.0/include/stddef.h: In function '__syscall0':/usr/lib/gcc/i386-redhat-linux/4.0.0/include/stddef.h:214: error: storage class
specified for parameter 'size_t'
In file included from /usr/include/stdio.h:36,
from syscall.c:3:
/usr/include/bits/types.h:34: error: storage class specified for parameter '__u_char'
/usr/include/bits/types.h:35: error: storage class specified for parameter '__u_short'
/usr/include/bits/types.h:36: error: storage class specified for parameter '__u_int'
/usr/include/bits/types.h:37: error: storage class specified for parameter '__u_long'
/////////////////////////////
and how do i know if sys_call_table is already exported in kernel and how to export it if not.
///////////////////////////////
Please Help..
~