unable to add own system call to red hat 9
Hi all,
i m trying to add a new system call in linux(red hat 9) kernel-2.4
following are the files for this
1.myroutine.c :this is saved in /usr/src/linux2.4/fs
code written in this file is:
#include <linux/myroutine.h>
asmlinkage int sys_myroutine(int arg1,int arg2){
return arg1+arg2;
}
i have changed in makefile
obj-y +=myroutine.o
2.myroutine.h :this is saved in /usr/src/linux2.4/include/linux/
code written in this file is:
#ifndef __LINUX_MYROUTINE_H
#define __LINUX_MYROUTINE_H
#include <linux/linkage.h>
#endif
3.myroutine.h :this is saved in /usr/include/sys/
code written in this file is:
#include <linux/unistd.h>
_syscall2(int, myroutine, int, arg1, int , arg2);
now i add one line in /usr/src/linux2.4/arch/i386/kernel/entry.S
.long SYMBOL_NAME(sys_myroutine)
add one lin in /usr/src/linux2.4/include/asm/unistd.h
#define __NR_myroutine 260
now i recompile the kernel,i got success in compiling kernel,then i reboot the system and run new kernel
nnow i write a program (myappl.c) to use this system call
myappl.c:this is saved in /usr/src/linux2.4/fs
code written in this file is:
include<linux/myroutine.h>
int main()
{
int sum;
sum = myroutine(10,10);
printf("%d",sum);
}
this runs in user mode to get the sum of two number using system call myroutine
but i got an error while compling this program.the error is
/tmp/ccOqqTMU.o(.text+0x18): In function `main':
: undefined reference to `myroutine'
collect2: ld returned 1 exit status
cold anybody please tell me what is the actual problem and where is this
Thanks & Regards
|