From fork(2)
:
* The child inherits copies of the parent’s set of open file descrip- tors. Each file descriptor in the child refers to the same open file description (see open(2)) as the corresponding file descriptor in the parent. This means that the two descriptors share open file status flags, current file offset, and signal-driven I/O attributes (see the description of F_SETOWN and F_SETSIG in fcntl(2)).
Related Contents:
- printf anomaly after “fork()”
- How to make child process die after parent exits?
- Why does this program print “forked!” 4 times?
- After forking, are global variables shared?
- How to use shared memory with Linux in C
- Differences between fork and exec
- How to capture Control+D signal?
- In C how do you redirect stdin/stdout/stderr to files when making an execvp() or similar call?
- Working of fork() in linux gcc [duplicate]
- stdout thread-safe in C on Linux?
- Why does ENOENT mean “No such file or directory”?
- Merge multiple .so shared libraries
- What does the brk() system call do?
- Turn a simple socket into an SSL socket
- Difference between “system” and “exec” in Linux?
- Re-opening stdout and stdin file descriptors after closing them
- How do I get a thread ID from an arbitrary pthread_t?
- Why does forking my process cause the file to be read infinitely
- Are there any platforms where using structure copy on an fd_set (for select() or pselect()) causes problems?
- Why the address of variable of child process and parent process is same
- Do forked child processes use the same semaphore?
- How can I convert a file pointer ( FILE* fp ) to a file descriptor (int fd)?
- What is the difference between using _exit() & exit() in a conventional Linux fork-exec?
- Detecting 64bit compile in C
- fd leak, custom Shell
- How to use POSIX semaphores on forked processes in C?
- Waiting for all child processes before parent resumes execution UNIX
- Questions about putenv() and setenv()
- How to write a signal handler to catch SIGSEGV?
- How to get the current directory in a C program?
- How to set socket timeout in C when making multiple connections?
- How do I execute an external program within C code in Linux with arguments?
- What is the purpose of a these #define within an enum?
- Best way to invoke gdb from inside program to print its stacktrace?
- Why does stdout need explicit flushing when redirected to file?
- Unexpected exec permission from mmap when assembly files included in the project
- Error: Address already in use while binding socket with address but the port number is shown free by `netstat`
- POSIX API call to list all the pthreads running in a process
- Read and write to binary files in C?
- How to implement a timeout in read() function call?
- What parts of this HelloWorld assembly code are essential if I were to write the program in assembly?
- Child process receives parent’s SIGINT
- How to compile my own glibc C standard library from source and use it?
- How to find the physical address of a variable from user-space in Linux?
- What are the differences between poll and select?
- Bind failed: Address already in use
- How does sig_atomic_t actually work?
- Why are malloc() and printf() said as non-reentrant?
- How to modify memory contents using GDB?
- How do *nix pseudo-terminals work ? What’s the master/slave channel?