1.\" $NetBSD: mount_fdesc.8,v 1.14 2003/08/07 10:04:27 agc Exp $ 2.\" 3.\" Copyright (c) 1992, 1993, 1994 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" This code is derived from software donated to Berkeley by 7.\" Jan-Simon Pendry. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. Neither the name of the University nor the names of its contributors 18.\" may be used to endorse or promote products derived from this software 19.\" without specific prior written permission. 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" SUCH DAMAGE. 32.\" 33.\" @(#)mount_fdesc.8 8.2 (Berkeley) 3/27/94 34.\" 35.Dd March 27, 1994 36.Dt MOUNT_FDESC 8 37.Os 38.Sh NAME 39.Nm mount_fdesc 40.Nd mount the file-descriptor file system 41.Sh SYNOPSIS 42.Nm 43.Op Fl o Ar options 44.Ar fdesc 45.Ar mount_point 46.Sh DESCRIPTION 47The 48.Nm 49command attaches an instance of the per-process file descriptor 50namespace to the global filesystem namespace. 51The conventional mount point is 52.Pa /dev 53and the filesystem should be union mounted in order to augment, 54rather than replace, the existing entries in 55.Pa /dev . 56This command is normally executed by 57.Xr mount 8 58at boot time. 59.Pp 60The options are as follows: 61.Bl -tag -width indent 62.It Fl o 63Options are specified with a 64.Fl o 65flag followed by a comma separated string of options. 66See the 67.Xr mount 8 68man page for possible options and their meanings. 69.El 70.Pp 71The contents of the mount point are 72.Pa fd , 73.Pa stderr , 74.Pa stdin , 75.Pa stdout 76and 77.Pa tty . 78.Pp 79.Pa fd 80is a directory whose contents 81appear as a list of numbered files 82which correspond to the open files of the process reading the 83directory. 84The files 85.Pa /dev/fd/0 86through 87.Pa /dev/fd/# 88refer to file descriptors which can be accessed through the file 89system. 90If the file descriptor is open and the mode the file is being opened 91with is a subset of the mode of the existing descriptor, the call: 92.Bd -literal -offset indent 93fd = open("/dev/fd/0", mode); 94.Ed 95.Pp 96and the call: 97.Bd -literal -offset indent 98fd = fcntl(0, F_DUPFD, 0); 99.Ed 100.Pp 101are equivalent. 102.Pp 103The files 104.Pa /dev/stdin , 105.Pa /dev/stdout 106and 107.Pa /dev/stderr 108appear as symlinks to the relevant entry in the 109.Pa /dev/fd 110sub-directory. 111Opening them is equivalent to the following calls: 112.Bd -literal -offset indent 113fd = fcntl(STDIN_FILENO, F_DUPFD, 0); 114fd = fcntl(STDOUT_FILENO, F_DUPFD, 0); 115fd = fcntl(STDERR_FILENO, F_DUPFD, 0); 116.Ed 117.Pp 118Flags to the 119.Xr open 2 120call other than 121.Dv O_RDONLY , 122.Dv O_WRONLY 123and 124.Dv O_RDWR 125are ignored. 126.Pp 127The 128.Pa /dev/tty 129entry is an indirect reference to the current process's controlling terminal. 130It appears as a named pipe (FIFO) but behaves in exactly the same way as 131the real controlling terminal device. 132.Sh FILES 133.Bl -tag -width /dev/stderr -compact 134.It Pa /dev/fd/# 135.It Pa /dev/stdin 136.It Pa /dev/stdout 137.It Pa /dev/stderr 138.It Pa /dev/tty 139.El 140.Sh SEE ALSO 141.Xr mount 2 , 142.Xr unmount 2 , 143.Xr tty 4 , 144.Xr fstab 5 , 145.Xr mount 8 146.Sh HISTORY 147The 148.Nm 149utility first appeared in 150.Bx 4.4 . 151.Sh BUGS 152This filesystem may not be NFS-exported. 153