1.\" 2.\" Copyright (c) 1992 The Regents of the University of California 3.\" Copyright (c) 1990, 1992 Jan-Simon Pendry 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 5.2 (Berkeley) 07/05/92 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 /dev/fd file system 20.Sh SYNOPSIS 21.Nm mount_fdesc 22.Op Fl F Ar fsoptions 23.Pa /dev/fd 24.Pa 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/fd . 32This command is normally executed by 33.Xr mount 8 34at boot time. 35.Pp 36The contents of the mount point appear as a list of numbered files 37which correspond to the open files of the process reading the 38directory. 39The files 40.Pa /dev/fd/0 41through 42.Pa /dev/fd/# 43refer to file descriptors which can be accessed through the file 44system. 45If the file descriptor is open and the mode the file is being opened 46with is a subset of the mode of the existing descriptor, the call: 47.Bd -literal -offset indent 48fd = open("/dev/fd/0", mode); 49.Ed 50.Pp 51and the call: 52.Bd -literal -offset indent 53fd = fcntl(0, F_DUPFD, 0); 54.Ed 55.Pp 56are equivalent. 57.Pp 58Opening the files 59.Pa /dev/stdin , 60.Pa /dev/stdout 61and 62.Pa /dev/stderr 63is equivalent to the following calls: 64.Bd -literal -offset indent 65fd = fcntl(STDIN_FILENO, F_DUPFD, 0); 66fd = fcntl(STDOUT_FILENO, F_DUPFD, 0); 67fd = fcntl(STDERR_FILENO, F_DUPFD, 0); 68.Ed 69.Pp 70Flags to the 71.Xr open 2 72call other than 73.Dv O_RDONLY , 74.Dv O_WRONLY 75and 76.Dv O_RDWR 77are ignored. 78.Sh FILES 79.Bl -tag -width /dev/stderr -compact 80.It Pa /dev/fd/# 81.It Pa /dev/stdin 82.It Pa /dev/stdout 83.It Pa /dev/stderr 84.El 85.Sh SEE ALSO 86.Xr mount 2 , 87.Xr unmount 2 , 88.Xr tty 4 , 89.Xr fstab 5 90.Sh CAVEATS 91No 92.Pa . 93and 94.Pa .. 95entries appear when listing the contents of the mount point. 96This makes sense in the context of this filesystem, but is inconsistent 97with usual filesystem conventions. 98However, it is still possible to refer to both 99.Pa . 100and 101.Pa .. 102in a pathname. 103.Pp 104This filesystem may not be NFS-exported. 105.Sh HISTORY 106The 107.Nm 108descriptor filesystem 109is 110.Ud 111