Kdar
February 11th, 2012, 10:15 PM
I was trying to add new system call to Linux Kernel: mynewcall (just to learn how to do it).
I followed this tutorial:
http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/
After I added new system call and compiled new kernel, I wrote basic test program to call that new system call:
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#define __NR_mynewcall 272
long mynewcall(int i){
return syscall(__NR_mynewcall, i);
}
int main(void)
{
printf("%d\n", mynewcall(15));
return 0;
}
Then I reboot, boot into new kernel and try to execute my test program, however it doesn't seem to do anything at all.
Do I declare system call in a wrong way there?
I followed this tutorial:
http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/
After I added new system call and compiled new kernel, I wrote basic test program to call that new system call:
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#define __NR_mynewcall 272
long mynewcall(int i){
return syscall(__NR_mynewcall, i);
}
int main(void)
{
printf("%d\n", mynewcall(15));
return 0;
}
Then I reboot, boot into new kernel and try to execute my test program, however it doesn't seem to do anything at all.
Do I declare system call in a wrong way there?