4.4BSD/usr/share/man/cat8/mount_fdesc.0
MOUNT_FDESC(8) BSD System Manager's Manual MOUNT_FDESC(8)
NNAAMMEE
mmoouunntt__ffddeesscc - mount the file-descriptor file system
SSYYNNOOPPSSIISS
mmoouunntt__ffddeesscc [--FF _f_s_o_p_t_i_o_n_s] _f_d_e_s_c _m_o_u_n_t___p_o_i_n_t
DDEESSCCRRIIPPTTIIOONN
The mmoouunntt__ffddeesscc command attaches an instance of the per-process file de-
scriptor namespace to the global filesystem namespace. The conventional
mount point is _/_d_e_v and the filesystem should be union mounted in order
to augment, rather than replace, the existing entries in _/_d_e_v. This com-
mand is normally executed by mount(8) at boot time.
The contents of the mount point are _f_d, _s_t_d_e_r_r, _s_t_d_i_n, _s_t_d_o_u_t and _t_t_y.
_f_d is a directory whose contents appear as a list of numbered files which
correspond to the open files of the process reading the directory. The
files _/_d_e_v_/_f_d_/_0 through _/_d_e_v_/_f_d_/_# refer to file descriptors which can be
accessed through the file system. If the file descriptor is open and the
mode the file is being opened with is a subset of the mode of the exist-
ing descriptor, the call:
fd = open("/dev/fd/0", mode);
and the call:
fd = fcntl(0, F_DUPFD, 0);
are equivalent.
The files _/_d_e_v_/_s_t_d_i_n, _/_d_e_v_/_s_t_d_o_u_t and _/_d_e_v_/_s_t_d_e_r_r appear as symlinks to
the relevant entry in the _/_d_e_v_/_f_d sub-directory. Opening them is equiva-
lent to the following calls:
fd = fcntl(STDIN_FILENO, F_DUPFD, 0);
fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
fd = fcntl(STDERR_FILENO, F_DUPFD, 0);
Flags to the open(2) call other than O_RDONLY, O_WRONLY and O_RDWR are
ignored.
The _/_d_e_v_/_t_t_y entry is an indirect reference to the current process's con-
trolling terminal. It appears as a named pipe (FIFO) but behaves in ex-
actly the same way as the real controlling terminal device.
FFIILLEESS
/dev/fd/#
/dev/stdin
/dev/stdout
/dev/stderr
/dev/tty
SSEEEE AALLSSOO
mount(2), unmount(2), tty(4), fstab(5)
CCAAVVEEAATTSS
No . and _._. entries appear when listing the contents of the _/_d_e_v_/_f_d di-
rectory. This makes sense in the context of this filesystem, but is in-
consistent with usual filesystem conventions. However, it is still pos-
sible to refer to both . and _._. in a pathname.
This filesystem may not be NFS-exported.
HHIISSTTOORRYY
The mmoouunntt__ffddeesscc utility first appeared in 4.4BSD.
4.4BSD June 9, 1993 2