I've just added a system call to the linux kernel. It simply takes a int argument and return a int. This is system call code:
asmlinkage int sys_mycall(int num)
{ printk("This is mycall.");
if(num%2==0)
num = 100003;
else
num = 3;
return num;
}
This is the code which should run the system call for testing:
#include<stdio.h>
#include<unistd.h>
int main()
{
int num;
num = syscall(335,1);
printf("%d",num);
}
My problem is that no matter what my argument is(like num = 1 or num = 2), the system only output 100003, never have 3.