Your Location is: Home > Linux-kernel
Does the close() system call close all references to the file?
Let's say we have a pipe,
my_pipe, which occupies file descriptors at entries 3 and 4 of the process's FDT (initial FDT scheme)
- First, we close the stdout standard output stream using
close(1)(updated FDT scheme).
- Next, using
dup(my_pipe), we create a copy of the pipe's writing end file descriptor at the lowest available FDT entry - in our case entry 1, which was made available in the previous step.
my_pipeis now referred to by both entry 1 and entry 4 (updated FDT scheme).
- The following command we run is
My question is - which of the file descriptors referring to
my_pipe will close?