G
gooch
This is not really a general c question but here goes anyway.
I am trying to add a system call to a kernel (redhat 2.4.18) for a
class I am taking and I have done the following.
in /usr/src/linux/include/asm/unistd.h
I added #define __NR_myfunctionname number
in /usr/src/linux/arch/i386/kernel/entry.S
I added .long SYMBOL_NAME(sys_myfunctionname)
and the next line is .rept NR_syscalls-(.-sys_call_table)/4
I then added to /usr/src/linux/kernel/sys.c
asmlinkage int sys_myfunctionname(int a)
{
return a*a;
}
I also added a symbolic link to /usr/include called asm which links to
/usr/src/linux/include/asm
I wrote a driver with a printf to output the function result and all I
get is
-1. I have tried it without arguments and simply tried to return a
value but that didn't seem to work either. I got instructions on how
to do this from a tutorial and have searched all the groups and the
web with no luck. I would appreciate any help someone might be able to
give.
Thanks
gooch
I am trying to add a system call to a kernel (redhat 2.4.18) for a
class I am taking and I have done the following.
in /usr/src/linux/include/asm/unistd.h
I added #define __NR_myfunctionname number
in /usr/src/linux/arch/i386/kernel/entry.S
I added .long SYMBOL_NAME(sys_myfunctionname)
and the next line is .rept NR_syscalls-(.-sys_call_table)/4
I then added to /usr/src/linux/kernel/sys.c
asmlinkage int sys_myfunctionname(int a)
{
return a*a;
}
I also added a symbolic link to /usr/include called asm which links to
/usr/src/linux/include/asm
I wrote a driver with a printf to output the function result and all I
get is
-1. I have tried it without arguments and simply tried to return a
value but that didn't seem to work either. I got instructions on how
to do this from a tutorial and have searched all the groups and the
web with no luck. I would appreciate any help someone might be able to
give.
Thanks
gooch