Computing.Net > Forums > Linux > Error when add a new system call.

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Error when add a new system call.

Reply to Message Icon

Name: GreenStar
Date: November 1, 2003 at 05:04:25 Pacific
OS: Redhat 9.0 Linux
CPU/Ram: PIII 850MHz, SD 256 MB
Comment:

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.



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: Error when add a new system call.

error when booting with file system www.computing.net/answers/linux/error-when-booting-with-file-system/11872.html

add a partition to the system www.computing.net/answers/linux/add-a-partition-to-the-system/25844.html

/dev/hda1 contains a file system with errors www.computing.net/answers/linux/devhda1-contains-a-file-system-with-errors/41.html