title: What does SYNOPSIS part in perror man page mean?
body: <p>SYNOPSIS section in <code>perror</code>'s <a href="http://man7.org/linux/man-pages/man3/perror.3.html" rel="nofollow noreferrer">man page</a> is:</p>
  
  <pre><code>   #include &lt;stdio.h&gt;
  
     void perror(const char *s);
  
     #include &lt;errno.h&gt;
  
     const char * const sys_errlist[];
     int sys_nerr;
     int errno;       /* Not really declared this way; see errno(3) */
  </code></pre>
  
  <p>according to <a href="https://linux.die.net/man/7/man-pages" rel="nofollow noreferrer">man page specification</a>, SYNOPSIS section indicates that</p>
  
  <blockquote>
    <p>For functions, it shows any required data declarations or #include directives, followed by the function declaration.</p>
  </blockquote>
  
  <p>The following code:</p>
  
  <pre><code>#include &lt;unistd.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main()
  {
      char *ls_args[2] = {"nonsense", NULL};
      execv(ls_args[0], ls_args); // no return
      perror("execve failed");
      return 2;
  }
  </code></pre>
  
  <p>outputs error message <code>execve failed: No such file or directory</code>, with corresponding <code>errno</code> being <code>2</code></p>
  
  <p>since <code>errno</code> is a global variable (actually a macro) defined in <code>errno.h</code>, and <code>errno.h</code> header is not included, how does this code trigger <code>errno</code> modification? </p>
  
  <p>What does <code>#include &lt;errno.h&gt; ... int errno;</code> mean in the SYNOPSIS section? seems like <code>perror()</code> can be called without this portion of code, thanks!</p>