Quantcast
Channel: Active questions tagged linux-kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 12244

Does the close() system call close all references to the file?

$
0
0

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)

  1. First, we close the stdout standard output stream using close(1) (updated FDT scheme).
  2. Next, using dup(my_pipe[1]), 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_pipe[1] is now referred to by both entry 1 and entry 4 (updated FDT scheme).
  3. The following command we run is close(my_pipe[1]).

My question is - which of the file descriptors referring to my_pipe[1] will close?


Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>