Showing posts with label dup2. Show all posts
Showing posts with label dup2. Show all posts

Friday, April 5, 2013

exec dup2

Not all properties of the process would change across an exec call. In other words, the new process inherits a number of properties from the calling process:
  • process ID and parent process ID
  • real user ID and reall group ID
  • supplementary group IDs
  • process group ID
  • session ID
  • controlling terminal
  • time left on alarm clock
  • current working directory
  • root directory
  • file mode creation mask
  • file locks
  • process signal mask
  • pending signals
  • resource limits
  • file descriptors without close-on-exec flag set
Obviously, here we care the most about open file descriptors. While we say that exec replaces the old process with a new one, most open file descriptors would remain open.