▲ | colanderman 3 days ago | |
Terminology nit: "file descriptor" is the reference itself. "Open file description" is the thing referenced. dup(2) and fork(2) create new file descriptors which reference the same underlying open file descriptions. | ||
▲ | zbentley 2 days ago | parent [-] | |
Correct, sorry! My phrasing was off-the-cuff and less than precise. File descriptor = reference/pointer-ish thing. File description = referenced data. close(2) = decrement refcount to description by closing descriptor; actual destruction of the file's open-ness doesn't happen until refcount == 0. |