title: getrandom syscall in C not found
body: <p><em>The problem was resolved by upgrading the C library.</em></p>
  
  <hr>
  
  <p>I would like to use the syscall getrandom (<a href="http://man7.org/linux/man-pages/man2/getrandom.2.html" rel="noreferrer">http://man7.org/linux/man-pages/man2/getrandom.2.html</a>)</p>
  
  <p>gcc-5 -std=c11 test.c</p>
  
  <pre><code>#include &lt;sys/types.h&gt;
  #include &lt;sys/stat.h&gt;
  #include &lt;sys/fcntl.h&gt;
  #include &lt;errno.h&gt;
  #include &lt;string.h&gt;
  #include &lt;signal.h&gt;
  #include &lt;linux/random.h&gt;
  #include &lt;sys/syscall.h&gt;
  
  int main(void)
  {
          void *buf = NULL;
          size_t l = 5;
          unsigned int o = 1;
          int r = syscall(SYS_getrandom, buf, l, o);
          return 0;
  }
  </code></pre>
  
  <p>or </p>
  
  <pre><code> int main(void)
      {
              void *buf = NULL;
              size_t l = 5;
              unsigned int o = 1;
              int r = getrandom(buf, l, o);
              return 0;
      }
  </code></pre>
  
  <p>Anyway when I try to compile it with gcc-5:</p>
  
  <pre><code>test.c: In function ‘main’:
  test.c:14:17: warning: implicit declaration of function ‘getrandom’ [-Wimplicit-function-declaration]
           int r = getrandom(buf, l, o);
                   ^
  /tmp/ccqFdJAJ.o: In function `main':
  test.c:(.text+0x36): undefined reference to `getrandom'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>I am using Ubuntu 14.04, what can I do to use getrandom?
  As it is a "new" syscall, how can I use it?</p>
  
  <p>edit:</p>
  
  <pre><code>uname -r
  -&gt; 4.0.3-040003-generic #201505131441 SMP Wed May 13 13:43:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
  </code></pre>
  
  <p>when I replace r by <code>int r = syscall(SYS_getrandom, buf, l, o);</code>
  or r = getrandom(buf, l, o) it is the same..</p>