Commit | Line | Data |
---|---|---|
853eb5c5 KB |
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 | .\" | |
19bc5c98 | 11 | .\" @(#)mount_fdesc.8 8.1 (Berkeley) %G% |
853eb5c5 KB |
12 | .\" |
13 | .\" | |
14 | .Dd | |
15 | .Dt MOUNT_FDESC 8 | |
16 | .Os BSD 4.4 | |
17 | .Sh NAME | |
18 | .Nm mount_fdesc | |
4338c5e0 | 19 | .Nd mount the file-descriptor file system |
853eb5c5 KB |
20 | .Sh SYNOPSIS |
21 | .Nm mount_fdesc | |
b787a10f | 22 | .Op Fl F Ar fsoptions |
4338c5e0 | 23 | .Pa fdesc |
b787a10f | 24 | .Pa mount_point |
853eb5c5 KB |
25 | .Sh DESCRIPTION |
26 | The | |
27 | .Nm mount_fdesc | |
28 | command attaches an instance of the per-process file descriptor | |
29 | namespace to the global filesystem namespace. | |
30 | The conventional mount point is | |
4338c5e0 JSP |
31 | .Pa /dev |
32 | and the filesystem should be union mounted in order to augment, | |
33 | rather than replace, the existing entries in | |
34 | .Pa /dev . | |
853eb5c5 KB |
35 | This command is normally executed by |
36 | .Xr mount 8 | |
37 | at boot time. | |
38 | .Pp | |
4338c5e0 JSP |
39 | The contents of the mount point are |
40 | .Pa fd , | |
41 | .Pa stderr , | |
42 | .Pa stdin , | |
43 | .Pa stdout | |
44 | and | |
45 | .Pa tty . | |
46 | .Pp | |
47 | .Pa fd | |
48 | is a directory whose contents | |
49 | appear as a list of numbered files | |
853eb5c5 KB |
50 | which correspond to the open files of the process reading the |
51 | directory. | |
52 | The files | |
53 | .Pa /dev/fd/0 | |
54 | through | |
55 | .Pa /dev/fd/# | |
56 | refer to file descriptors which can be accessed through the file | |
57 | system. | |
58 | If the file descriptor is open and the mode the file is being opened | |
59 | with is a subset of the mode of the existing descriptor, the call: | |
60 | .Bd -literal -offset indent | |
61 | fd = open("/dev/fd/0", mode); | |
62 | .Ed | |
63 | .Pp | |
64 | and the call: | |
65 | .Bd -literal -offset indent | |
66 | fd = fcntl(0, F_DUPFD, 0); | |
67 | .Ed | |
68 | .Pp | |
69 | are equivalent. | |
70 | .Pp | |
4338c5e0 | 71 | The files |
853eb5c5 KB |
72 | .Pa /dev/stdin , |
73 | .Pa /dev/stdout | |
74 | and | |
75 | .Pa /dev/stderr | |
4338c5e0 JSP |
76 | appear as symlinks to the relevant entry in the |
77 | .Pa /dev/fd | |
78 | sub-directory. | |
79 | Opening them is equivalent to the following calls: | |
853eb5c5 KB |
80 | .Bd -literal -offset indent |
81 | fd = fcntl(STDIN_FILENO, F_DUPFD, 0); | |
82 | fd = fcntl(STDOUT_FILENO, F_DUPFD, 0); | |
83 | fd = fcntl(STDERR_FILENO, F_DUPFD, 0); | |
84 | .Ed | |
85 | .Pp | |
86 | Flags to the | |
87 | .Xr open 2 | |
88 | call other than | |
89 | .Dv O_RDONLY , | |
90 | .Dv O_WRONLY | |
91 | and | |
92 | .Dv O_RDWR | |
93 | are ignored. | |
4338c5e0 JSP |
94 | .Pp |
95 | The | |
96 | .Pa /dev/tty | |
97 | entry is an indirect reference to the current process's controlling terminal. | |
98 | It appears as a named pipe (FIFO) but behaves in exactly the same way as | |
99 | the real controlling terminal device. | |
853eb5c5 KB |
100 | .Sh FILES |
101 | .Bl -tag -width /dev/stderr -compact | |
102 | .It Pa /dev/fd/# | |
103 | .It Pa /dev/stdin | |
104 | .It Pa /dev/stdout | |
105 | .It Pa /dev/stderr | |
4338c5e0 | 106 | .It Pa /dev/tty |
853eb5c5 KB |
107 | .El |
108 | .Sh SEE ALSO | |
109 | .Xr mount 2 , | |
110 | .Xr unmount 2 , | |
111 | .Xr tty 4 , | |
112 | .Xr fstab 5 | |
113 | .Sh CAVEATS | |
114 | No | |
115 | .Pa . | |
116 | and | |
117 | .Pa .. | |
4338c5e0 JSP |
118 | entries appear when listing the contents of the |
119 | .Pa /dev/fd | |
120 | directory. | |
853eb5c5 KB |
121 | This makes sense in the context of this filesystem, but is inconsistent |
122 | with usual filesystem conventions. | |
123 | However, it is still possible to refer to both | |
124 | .Pa . | |
125 | and | |
126 | .Pa .. | |
127 | in a pathname. | |
128 | .Pp | |
129 | This filesystem may not be NFS-exported. | |
130 | .Sh HISTORY | |
131 | The | |
132 | .Nm | |
133 | descriptor filesystem | |
134 | is | |
135 | .Ud |