Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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 258And 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.

![]() |
![]() |
![]() |

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