1FD(4)                      Kernel Interfaces Manual                      FD(4)
2
3
4

NAME

6       fd, stdin, stdout, stderr file descriptor files
7

DESCRIPTION

9       The  files  /dev/fd/0 through /dev/fd/# refer to file descriptors which
10       can be accessed through the file system.  If  the  file  descriptor  is
11       open and the mode the file is being opened with is a subset of the mode
12       of the existing descriptor, the call:
13
14            fd = open("/dev/fd/0", mode);
15
16       and the call:
17
18            fd = fcntl(0, F_DUPFD, 0);
19
20       are equivalent.
21
22       Opening the files /dev/stdin, /dev/stdout and /dev/stderr is equivalent
23       to the following calls:
24
25            fd = fcntl(STDIN_FILENO,  F_DUPFD, 0);
26            fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
27            fd = fcntl(STDERR_FILENO, F_DUPFD, 0);
28
29       Flags  to the open(2) call other than O_RDONLY, O_WRONLY and O_RDWR are
30       ignored.
31

FILES

33       /dev/fd/#
34       /dev/stdin
35       /dev/stdout
36       /dev/stderr
37

SEE ALSO

39       tty(4)
40
41
42
434th Berkeley Distribution      February 4, 1997                          FD(4)
Impressum