LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-17-2006, 05:34 AM   #1
bhushanv
LQ Newbie
 
Registered: Mar 2006
Posts: 2

Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
add new system call linux_lover2005 Programming 2 10-14-2006 01:37 AM
how to add another system call in to the kernel?? Pratik H Pandya Programming 1 03-26-2006 02:02 AM
To add our own system call,compilation problem hegdeshashi Linux - Networking 1 01-27-2006 11:13 PM
Error when add a new system call in RH9.0. GreenStar Linux - Newbie 2 11-01-2003 01:52 PM
Samba 2.2.7a fails to call add user script on Red Hat 9 DrFooMod2 Linux - Networking 4 07-17-2003 09:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration