title: mmap error on linux (using somethingelse)
body: <p>Exactly, I thought that I finished my project until compiling isn't accepted on ubuntu because of <code>mmap()</code>. I'm trying to access(read) files by using <code>fork()</code>. It's okey. But, When I want to count number of read files, entered folder(directories) and child, I powned! How and What can I use or change <code>mmap()</code> because I get <code>error: ‘MAP_ANON’ undeclared (first use in this function)|</code>
  . On mac, It's okey but on ubuntu error. Thank you for helps.</p>
  
  <pre><code>    #define _XOPEN_SOURCE 700
      #define _POSIX_C_SOURCE 200809L
  
      #include &lt;stdio.h&gt;
      #include &lt;stdlib.h&gt;
      #include &lt;string.h&gt;
      #include &lt;unistd.h&gt;
      #include &lt;sys/types.h&gt;
      #include &lt;sys/stat.h&gt;
      #include &lt;sys/wait.h&gt;
      #include &lt;dirent.h&gt;
      #include &lt;errno.h&gt;
      #include &lt;ftw.h&gt;
      #include &lt;ctype.h&gt;
      #include &lt;sys/mman.h&gt;
  
  
  
      #define MAX_PATH_LEN        2048
  
  
      static int *wordCount = 0;
      static int *childCount = 0;
      static int *folderCount = 0;
  
  
  
      int relatedWord(const char *arr);
  
      int checkWord(const char arr[], int size);
  
      void err_sys(const char *msg);
  
      int disp(const char *filepath, const struct stat *finfo, int flag, struct FTW *ftw);
  
  
      int main(int argc, char *argv[])
      {
          //struct stat finfo;
  
          //int count = 0;
  
          wordCount = mmap(NULL, sizeof *wordCount, PROT_READ | PROT_WRITE,MAP_SHARED | MAP_ANON, -1, 0);
          childCount = mmap(NULL, sizeof *childCount, PROT_READ | PROT_WRITE,MAP_SHARED | MAP_ANON, -1, 0);
          folderCount = mmap(NULL, sizeof *folderCount, PROT_READ | PROT_WRITE,MAP_SHARED | MAP_ANON, -1, 0);
  
          if (argc != 2) {
              fprintf(stderr, "Wrong number of arguments!\nUsage: dirwalk6 &lt;path&gt;\n");
              exit(EXIT_FAILURE);
          }
  
          if (nftw(argv[1], disp, 20, 0) &lt; 0)
              err_sys("ntfw");
  
          printf( "\nTotal words = %d\n\n", *wordCount);
          printf( "\nTotal folders = %d\n\n", *folderCount);
          printf( "\nTotal childs = %d\n\n", *childCount);
  
  
          return 0;
      }
  
  int disp(const char *filepath, const struct stat *finfo, int flag, struct FTW *ftw)
  {
  
      int count = 0; /* number of words */
  
      switch (flag) {
          case FTW_F: /* determining file */
  
              printf("%*s%s\n", ftw-&gt;level * 4, "", filepath);
  
              pid_t pid;
  
              pid=fork();
  
              if(pid &lt; 0)
              {
                  perror("Error corresponding to fork()");
              }
              else if (pid == 0)
              {
  
                  count += relatedWord(filepath);
                  *wordCount += count;
                  *childCount += 1;
                  exit(1);
  
              }
              else
              {
                  while( pid != wait(0) ) ;
              }
              // printf( "word = %d,   file = %s \n", count,filepath);
  
              break;
          case FTW_D:  /* determining folder */
              printf("%*s%s\n", ftw-&gt;level * 4, "", filepath + ftw-&gt;base);
              *folderCount += 1;
              break;
      }
  
      return 0;
  }
  </code></pre>