title: Sometimes cannot get stack range from /proc/self/maps
body: <p>I have one problem. I am trying to get stack offset range from /proc/self/maps pseudofile. But I have sometime weird things. 
  Here is my code</p>
  
  <pre><code> fp = fopen("/proc/self/maps", "r");
      if (fp == NULL) {
          perror("Error opening file");
          return NULL;
      }
      while (fgets(line, 2048, fp) != NULL) {
          if (strstr(line, "stack") != NULL) {
              printf("%s", line);
          }
   }
  </code></pre>
  
  <p>If you start the programm with one or multiple thread you can view this pseudo file and get something like this </p>
  
  <pre><code>7f20423a6000-7f2042ba6000 rw-p 00000000 00:00 0                          [stack:3936]
  7fffbe95e000-7fffbe97f000 rw-p 00000000 00:00 0                          [stack]
  </code></pre>
  
  <p>the first line here is stack of thread , the second line is the stack of the process.
  But the problem is that sometimes I cannot get stack of thread. It can be from the first time or appear on some next execution so it is not determined. On some distos it doesn't show stack of thread at all, I don't think the problem is in different implementation of pseudo file in distros but in something other.
  Please help to solve this problem </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I actually call this function inside thread , so I create thread through  <code>pthread_create(&amp;tid, NULL, proc_stack, NULL);</code>I have been also thinking about this. Maybe it needs some time to update this pseudofile after thread start, this is only one reason I see here.</p>
  
  <p><strong>EDIT2</strong></p>
  
  <p>I've tried to call sleep forcely , but this didn't help, but the most weird is that on one distro it shows thread stack, on another doesn't.</p>