1.\" 2.\" Copyright (c) 1992, 1993, 1994 3.\" The Regents of the University of California. All rights reserved. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software donated to Berkeley by 7.\" Jan-Simon Pendry. 8.\" 9.\" %sccs.include.redist.roff% 10.\" 11.\" @(#)mount_fdesc.8 8.2 (Berkeley) 03/27/94 12.\" 13.\" 14.Dd 15.Dt MOUNT_FDESC 8 16.Os BSD 4.4 17.Sh NAME 18.Nm mount_fdesc 19.Nd mount the file-descriptor file system 20.Sh SYNOPSIS 21.Nm mount_fdesc 22.Op Fl o Ar options 23.Ar fdesc 24.Ar mount_point 25.Sh DESCRIPTION 26The 27.Nm mount_fdesc 28command attaches an instance of the per-process file descriptor 29namespace to the global filesystem namespace. 30The conventional mount point is 31.Pa /dev 32and the filesystem should be union mounted in order to augment, 33rather than replace, the existing entries in 34.Pa /dev . 35This command is normally executed by 36.Xr mount 8 37at boot time. 38.Pp 39The options are as follows: 40.Bl -tag -width indent 41.It Fl o 42Options are specified with a 43.Fl o 44flag followed by a comma separated string of options. 45See the 46.Xr mount 8 47man page for possible options and their meanings. 48.El 49.Pp 50The contents of the mount point are 51.Pa fd , 52.Pa stderr , 53.Pa stdin , 54.Pa stdout 55and 56.Pa tty . 57.Pp 58.Pa fd 59is a directory whose contents 60appear as a list of numbered files 61which correspond to the open files of the process reading the 62directory. 63The files 64.Pa /dev/fd/0 65through 66.Pa /dev/fd/# 67refer to file descriptors which can be accessed through the file 68system. 69If the file descriptor is open and the mode the file is being opened 70with is a subset of the mode of the existing descriptor, the call: 71.Bd -literal -offset indent 72fd = open("/dev/fd/0", mode); 73.Ed 74.Pp 75and the call: 76.Bd -literal -offset indent 77fd = fcntl(0, F_DUPFD, 0); 78.Ed 79.Pp 80are equivalent. 81.Pp 82The files 83.Pa /dev/stdin , 84.Pa /dev/stdout 85and 86.Pa /dev/stderr 87appear as symlinks to the relevant entry in the 88.Pa /dev/fd 89sub-directory. 90Opening them is equivalent to the following calls: 91.Bd -literal -offset indent 92fd = fcntl(STDIN_FILENO, F_DUPFD, 0); 93fd = fcntl(STDOUT_FILENO, F_DUPFD, 0); 94fd = fcntl(STDERR_FILENO, F_DUPFD, 0); 95.Ed 96.Pp 97Flags to the 98.Xr open 2 99call other than 100.Dv O_RDONLY , 101.Dv O_WRONLY 102and 103.Dv O_RDWR 104are ignored. 105.Pp 106The 107.Pa /dev/tty 108entry is an indirect reference to the current process's controlling terminal. 109It appears as a named pipe (FIFO) but behaves in exactly the same way as 110the real controlling terminal device. 111.Sh FILES 112.Bl -tag -width /dev/stderr -compact 113.It Pa /dev/fd/# 114.It Pa /dev/stdin 115.It Pa /dev/stdout 116.It Pa /dev/stderr 117.It Pa /dev/tty 118.El 119.Sh SEE ALSO 120.Xr mount 2 , 121.Xr unmount 2 , 122.Xr tty 4 , 123.Xr fstab 5 , 124.Xr mount 8 125.Sh CAVEATS 126No 127.Pa . 128and 129.Pa .. 130entries appear when listing the contents of the 131.Pa /dev/fd 132directory. 133This makes sense in the context of this filesystem, but is inconsistent 134with usual filesystem conventions. 135However, it is still possible to refer to both 136.Pa . 137and 138.Pa .. 139in a pathname. 140.Pp 141This filesystem may not be NFS-exported. 142.Sh HISTORY 143The 144.Nm mount_fdesc 145utility first appeared in 4.4BSD. 146