|
|
1.1 root 1: .\" Copyright (c) 1990 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted
5: .\" provided that: (1) source distributions retain this entire copyright
6: .\" notice and comment, and (2) distributions including binaries display
7: .\" the following acknowledgement: ``This product includes software
8: .\" developed by the University of California, Berkeley and its contributors''
9: .\" in the documentation or other materials provided with the distribution
10: .\" and in all advertising materials mentioning features or use of this
11: .\" software. Neither the name of the University nor the names of its
12: .\" contributors may be used to endorse or promote products derived
13: .\" from this software without specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15: .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16: .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)fd.4 5.1 (Berkeley) 5/10/90
19: .\"
20: .TH FD 4 "May 10, 1990"
21: .UC 7
22: .SH NAME
23: fd, stdin, stdout, stderr \- file descriptor files
24: .SH DESCRIPTION
25: The files
26: .I /dev/fd/0
27: through
28: .I /dev/fd/#
29: refer to file descriptors which can be accessed through the file
30: system.
31: If the file descriptor is open and the mode the file is being opened
32: with is a subset of the mode of the existing descriptor, the call:
33: .sp
34: .RS
35: fd = open("/dev/fd/0", mode);
36: .RE
37: .sp
38: and the call:
39: .sp
40: .RS
41: fd = fcntl(0, F_DUPFD, 0);
42: .RE
43: .sp
44: are equivalent.
45: .PP
46: Opening the files
47: .IR /dev/stdin ,
48: .I /dev/stdout
49: and
50: .I /dev/stderr
51: is equivalent to the following calls:
52: .sp
53: .RS
54: fd = fcntl(STDIN_FILENO, F_DUPFD, 0);
55: .br
56: fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
57: .br
58: fd = fcntl(STDERR_FILENO, F_DUPFD, 0);
59: .RE
60: .PP
61: Flags to the
62: .IR open (2)
63: call other than O_RDONLY, O_WRONLY and O_RDWR are ignored.
64: .SH FILES
65: /dev/fd/#
66: .br
67: /dev/stdin
68: .br
69: /dev/stdout
70: .br
71: /dev/stderr
72: .SH SEE ALSO
73: tty(4)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.