title: warning: implicit declaration of function ‘getresuid’ (and ‘seteuid’)
body: <p>I would like to get rid of the warnings. When I compile the source code with</p>
  
  <pre><code>gcc -Wall -ansi -o test test.c  
  </code></pre>
  
  <p>I get back</p>
  
  <pre><code>test.c: In function ‘main’:
  test.c:12: warning: implicit declaration of function ‘getresuid’
  test.c:14: warning: implicit declaration of function ‘seteuid’
  </code></pre>
  
  <p>When I compile it without <strong>-ansi</strong> switch</p>
  
  <pre><code>gcc -Wall -o test test.c 
  </code></pre>
  
  <p>I see on the terminal</p>
  
  <pre><code>test.c: In function ‘main’:
  test.c:12: warning: implicit declaration of function ‘getresuid’
  </code></pre>
  
  <p>I would like to use <strong>-ansi</strong> switch and get rid of warnings. How can I achieve my goal ?  </p>
  
  <pre><code>/*  this is the test.c */
  #include &lt;stdio.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;unistd.h&gt;
  
  #define __USE_GNU 1
  #define __USE_BSD 1
  
  int main()
  {
     static uid_t euid, ruid, suid;
  
     getresuid(&amp;ruid, &amp;euid, &amp;suid);  
  
     seteuid(getuid()); 
  
     return 0;
  }
  </code></pre>
  
  <p>Environment:</p>
  
  <blockquote>
    <p>CentOS 6.3  32-bit<br>
    gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) </p>
  </blockquote>