title: What does dup2 actually do in this case?
body: <p>I need some clarification here:
  I have some code like this:</p>
  
  <pre><code>child_map[0] = fileno(fd[0]);
  ..
  pid = fork();
  if(pid == 0)
  /* child process*/
  dup2(child_map[0], STDIN_FILENO);
  </code></pre>
  
  <p>Now, will STDIN_FILENO and child_map[0] point to the same file descriptor ? Will the future inputs be taken from the file pointed to by child_map[0] and STDIN_FILENO ? 
  I thought STDIN_FILENO means the standard output(terminal). </p>