1 .\" Copyright (c) 2021 The FreeBSD Foundation, Inc.
4 .\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved.
6 .\" Copyright (c) 1992, 1993, 1994
7 .\" The Regents of the University of California. All rights reserved.
8 .\" All rights reserved.
10 .\" This code is derived from software donated to Berkeley by
13 .\" Parts of this documentation was written by
14 .\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
15 .\" from the FreeBSD Foundation.
17 .\" Redistribution and use in source and binary forms, with or without
18 .\" modification, are permitted provided that the following conditions
20 .\" 1. Redistributions of source code must retain the above copyright
21 .\" notice, this list of conditions and the following disclaimer.
22 .\" 2. Redistributions in binary form must reproduce the above copyright
23 .\" notice, this list of conditions and the following disclaimer in the
24 .\" documentation and/or other materials provided with the distribution.
25 .\" 3. Neither the name of the University nor the names of its contributors
26 .\" may be used to endorse or promote products derived from this software
27 .\" without specific prior written permission.
29 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48 .Nd file-descriptor file system
51 fdescfs /dev/fd fdescfs rw 0 0
54 The file-descriptor file system, or
56 provides access to the per-process file descriptor
57 namespace in the global file system namespace.
58 The conventional mount point is
61 The file system's contents
62 appear as a list of numbered files
63 which correspond to the open files of the process reading the
69 refer to file descriptors which can be accessed through the file
72 The following mount options can be used when mounting
75 .Bl -tag -width linrdlnk
77 For file descriptors referencing vnodes, instead of the
79 semantic described above, implement re-opening of the referenced vnode.
80 See below for more details.
82 Report the type of the
92 ABI compatibility mount
104 if the file descriptor is open and the mode the file is being opened
105 with is a subset of the mode of the existing descriptor, the call:
106 .Bd -literal -offset indent
107 fd = open("/dev/fd/0", mode);
111 .Bd -literal -offset indent
112 fd = fcntl(0, F_DUPFD, 0);
129 option, and file descriptor referencing a vnode, the call:
130 .Bd -literal -offset indent
131 fd = open("/dev/fd/0", mode);
134 reopens the referenced vnode with the specified
138 call above is equivalent to
139 .Bd -literal -offset indent
140 fd = openat(0, "", O_EMPTY_PATH, mode);
143 In particular, if the file descriptor was opened with the
153 option allows one to convert it to a regularly opened file,
154 assuming that the current permissions allow the requested
162 files are created by default when devfs alone is mounted.
164 creates entries for all file descriptors opened by the process.
166 .Bl -tag -width /dev/stderr -compact
175 .Dl "mount -t fdescfs none /dev/fd"
181 .Dl "mount -t fdescfs -o linrdlnk none /compat/linux/dev/fd"
187 .Dl "mount -t fdescfs -o nodup none /dev/fdpath"
194 file system first appeared in
198 manual page first appeared in
204 manual page was written by
205 .An Mike Pritchard Aq Mt mpp@FreeBSD.org ,
207 manual page written by
208 .An Jan-Simon Pendry .