> POSIX allows file descriptors to be shared by an arbitrary number of processes, after e.g. forks or SCM_RIGHTS transfers (even though this use case is most likely very rare, so it’s not entirely impossible for this state to be moved to userspace).<p>Normally it’s rare, except shell functionality crucially depends on it[1].<p>The way to think about this, IMO, is that while a disk file is more or less random-access, when you open it unavoidably turns into strange hybrid of a random-access byte array and a (seekable) byte stream (classically, the “file description”), and <i>that</i> is what the resulting fd and any of its copies point at. Seekable streams made some sense in the age of tape drives, but nowadays it seems to me that random-access files and non-seekable streams have enough of a gulf between them that forcing both to appear like the same kind of object is more confusing than helpful.<p>(I don’t know what my ideal world would look like, given I still like to direct streams from/to files. I still dislike the “file description” business rather strongly.)<p>[1] <a href="https://utcc.utoronto.ca/~cks/space/blog/unix/DupSharedOffsetNecessary" rel="nofollow">https://utcc.utoronto.ca/~cks/space/blog/unix/DupSharedOffse...</a>