1fd(4) File Formats fd(4)
2
3
4
6 fd - file descriptor files
7
9 These files, conventionally called /dev/fd/0, /dev/fd/1, /dev/fd/2,
10 and so on, refer to files accessible through file descriptors. If file
11 descriptor n is open, these two system calls have the same effect:
12
13 fd = open("/dev/fd/n",mode);
14 fd = dup(n);
15
16
17
18
19 On these files creat(2) is equivalent to open, and mode is ignored. As
20 with dup, subsequent reads or writes on fd fail unless the original
21 file descriptor allows the operations.
22
23
24 For convenience in referring to standard input, standard output, and
25 standard error, an additional set of names is provided: /dev/stdin is
26 a synonym for /dev/fd/0, /dev/stdout for /dev/fd/1, and /dev/stderr
27 for /dev/fd/2.
28
30 creat(2), dup(2), open(2)
31
33 open(2) returns −1 and EBADF if the associated file descriptor is not
34 open.
35
36
37
38SunOS 5.11 3 Jul 1990 fd(4)