title: How to write system calls on debian/ubuntu
body: <p>I am trying to write a system call of my own. It would just return the current time. I know the concept of what should I do and I did go through a couple of links like these:</p>
  
  <ul>
  <li><p><a href="http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/" rel="nofollow noreferrer">Implementing a System Call on Linux 2.6 for i386
  </a></p></li>
  <li><p><a href="http://www.cs.rochester.edu/users/faculty/sandhya/csc256/assignments/adding-a-system-call.html" rel="nofollow noreferrer">Another of the System call implementation</a></p></li>
  </ul>
  
  <p>But I am still confused and have not got the desired result. The kernel is not compiling and its crashing due to problems. I have tried it on debian latest stable release of 3.X.X</p>
  
  <p>Could someone point me out to a clean <code>hello world</code> kind of program to develop system calls?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>To the <a href="https://stackoverflow.com/a/12474768/728863">below answer</a>, here are my problems:</p>
  
  <ol>
  <li><p><code>File 3: linux-x.x.x/arch/x86/kernel/syscall_table_32.S</code> is not found in my linux folder. I had to improvise and so modified the following file: <code>linux-x.x.x/arch/x86/syscalls/syscall_64.tbl</code></p></li>
  <li><p>The above (1) new file mentioned had different pattern of <code>&lt;number&gt; &lt;64/x32/common&gt; &lt;name&gt; &lt;entry point&gt;</code> and my entry was `313 common </p></li>
  <li><p>The kernel image did compile successfully, but I couldnt call the function. It gives an <code>undefined reference" error</code> when i compile it with gcc. Why?</p></li>
  </ol>