LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-01-2003, 07:28 AM   #1
GreenStar
LQ Newbie
 
Registered: Nov 2003
Location: VietNam
Distribution: Linux RedHat 9.0
Posts: 1

Rep: Reputation: 0
Question Error when add a new system call in RH9.0.


Hi all,
I need your help !
I am a newbie of Linux, I use Linux Redhat 9.0, kernel 2.4.20-8.
I want to add a new systam call in kernel but i got an error
This is what i have done:
I add a new entry in /arch/i386/kernel/entry.S :
................................./*kernel system call*/
.long SYMBOL(sys_demo_write)
before this line:
.rept (..)
Then, I add in /include/i-386/linux/unistd.h
..................../*kernel systemcall*/
#define __NR_demo_write 259
the last system call in my kernel is 258

And i add add function in /kernel/sys.c like this:
asmlinkage int sys_demo_write()
{
printk("This is a systemcall");
return 0;
}
After i compile kernel and run it.
I creat a program to test my new system call like this:
#include <stdio.h>
#include <stdlib.h>
#include <linux/unistd.h>

_syscall0(int,sys_demo_write);
int main ()
{
sys_demo_write();
return 0;
}

But when i compile this program with gcc, i got an error:
"In function demo_write,
__NR_demo_write undeclared.
"
I do not know what happen, can you please help me correct this error.
Thank you very much.
 
Old 11-01-2003, 01:31 PM   #2
musrum
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 112

Rep: Reputation: 15
Well, firstly, you are in the wrong place for such a question. You probably should subscribe to the linux kernel mailing list. Go to www.kernel.org and scroll down a bit. You will find instructions for subscribing.

Second, when you change the arch includes in your linux kernel source tree, this does not change the includes in your /usr/include tree - nor should it. Nor can you casually change those files, or you potentially break any other build that doesn't know about your changes to the ABI.

Just curious, why do you want to add a syscall?
 
Old 11-01-2003, 01:52 PM   #3
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
moderators please delete

Last edited by kev82; 11-01-2003 at 03:07 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
kernel : how to add sys call through modules only? pinkeshzaveri Programming 1 09-14-2005 03:17 AM
how to add my own system call in RedHat linux9.0(2.4.7-20kernel) tyler28 Programming 0 06-15-2005 04:06 AM
NETPERF: ERROR --> send_udp_stream: error on remote: Interrupted system call dravya Linux - General 1 05-29-2004 05:49 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 - Newbie

All times are GMT -5. The time now is 05:29 AM.

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