title: Why can't errno's value be printed?
body: <p>I am looking at the following code in an SO "Low Quality" post to make sure the sample works, and my question is why can't I print errno's value?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;errno.h&gt;
  
  int main(){
      FILE *fp;
      errno = 0;
      fp=fopen("Not_exist.txt","r");
      if(fp == NULL &amp;&amp; errno == ENOENT)
          perror("file not exist");
      return 0;
  }
  </code></pre>
  
  <p>Here is what happens when I try to print the value:</p>
  
  <pre><code>(gdb) p errno
  Cannot find thread-local variables on this target
  (gdb)
  </code></pre>
  
  <p>I can print fp's value just fine. As you would expect it's value is <code>0x00</code>.</p>
  
  <p>I looked at <code>/usr/include/errno.h</code> and a lot of the other include files included as part of <code>errno.h</code>, and I cannot figure out how errno is defined. Any pointers or help would be appreciated. I'm just curious about it; nothing is broken. </p>
  
  <p>Thank you.</p>