Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search

11. mycall.c

Full path of the file - /usr/src/linux/mycall/mycall.c

  1. Create a source file named "mycall.c" in dir "mycall". mycall.c will have the code for our system call. The definition of the system call in the source file would be asmlinkage long sys_mycall(...){...} . It should include the file linux/linkage.h So, the file "mycall.c" will look like:

/*---Start of mycall.c----*/

#include<linux/linkage.h>

asmlinkage long sys_mycall(int i)

{

return i+10;

}

/*---End of mycall.c------*/

What is asmlinkage?

Asmlinkage is used to look for the arguments on the kernel stack.