Different operating systems use different mechanisms to make a process's internal state visible in the file hierarchy. In particular, this applies to making each process's file-descriptors accessible.

In most Linux distributions, /dev/fd is a symbolic link to /proc/self/fd, where /proc is a special file-system synthesized by the kernel. Within that, self is a symlink to each process's own process ID, and /proc/$PID/fd/$FD is a pseudo file representing the open file-descriptor $FD for the process $PID.

Those pseudo files appear to be symbolic links to the original filename by which the file descriptor was opened, but otherwise accessing the filename continues to access the underlying original file, even if the referrent of the symbolic link has been deleted or replaced. The permissions on the link indicate whether the file descriptor is open for reading, writing or both.

In other operating systems, /dev/fd/$FD may simlarly appear to be a symlink, or it may be represented as a (block or character) device, and has no particular association with the original filename.

NamedFileDescriptor (last edited 2013-11-22 03:35:03 by 41)