title: Where do I add a systemcall to the linux Kernel source
body: <p>I am trying to add a new helloworld system call to a new version of the Linux Ubuntu kernel.  I have been looking through the web but I cannot find a consistent example to show me what files I will have to modify to enable a helloworld system call to be added to the kernel.</p>
  
  <p>I have tried many and compile error have occurred.
  I know how to compile the kernel, but I just don't know where I add my c program system call, and where I add this call to the system call table and anything else I have to do.</p>
  
  <p>I am working on the newest Linux Ubuntu kernel.</p>
  
  <p>I compiled the kernel with a new system call introduced, a simple call called mycall, now I am getting compile errors within the header file of my application that will test the call, below is my header file</p>
  
  <pre><code>#include&lt;linux/unistd.h&gt;
  
  #define __NR_mycall 317
  
  _syscall1(long, mycall, int, i)
  </code></pre>
  
  <p>This is the syntax error I am getting</p>
  
  <pre><code>stef@ubuntu:~$ gcc -o testmycall testmycall.c
  In file included from testmycall.c:3:
  testmycall.h:7: error: expected declaration specifiers or ‘...’ before ‘mycall’
  testmycall.h:7: error: expected declaration specifiers or ‘...’ before ‘i’
  testmycall.c: In function ‘_syscall1’:
  testmycall.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
  testmycall.h:7: error: parameter name omitted
  testmycall.h:7: error: parameter name omitted
  testmycall.c:11: error: expected ‘{’ at end of in
  </code></pre>
  
  <p>I got a lot of help from the below link from Nikolai N Fetissov </p>