47 lines
1.3 KiB
Groff
47 lines
1.3 KiB
Groff
'\"! tbl | mmdoc
|
|
'\"macro stdmacro
|
|
.if n .pH g4.fd @(#)fd 40.4 of 1/3/91
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989, 1990 AT&T
|
|
.nr X
|
|
.if \nX=0 .ds x} fd 4 "" "\&"
|
|
.if \nX=1 .ds x} fd 4 ""
|
|
.if \nX=2 .ds x} fd 4 "" "\&"
|
|
.if \nX=3 .ds x} fd "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
\f4/dev/fd\f1 \- file descriptor files
|
|
.SH DESCRIPTION
|
|
These files, conventionally called \f4/dev/fd/0\fP,
|
|
\f4/dev/fd/1\fP, \f4/dev/fd/2\fP, and so on, refer
|
|
to files accessible through file descriptors.
|
|
If file descriptor \f2n\fP is open, these two
|
|
system calls have the same effect:
|
|
.PP
|
|
.nf
|
|
.RS
|
|
.ft 4
|
|
fd = open("/dev/fd/\f2n\fP",mode);
|
|
.br
|
|
fd = dup(\f2n\fP);
|
|
.PP
|
|
.fi
|
|
.RE
|
|
.ft 1
|
|
On these files \f4creat\fP(2) is equivalent to
|
|
\f4open\fP, and \f4mode\fP is ignored.
|
|
As with \f4dup\fP, subsequent reads or writes
|
|
on \f4fd\fP fail unless the original
|
|
file descriptor allows the operations.
|
|
.PP
|
|
.\"For convenience in referring to standard input,
|
|
.\"standard output, and standard error, an additional
|
|
.\"set of names is provided: \f4/dev/fd/0\fP is a
|
|
.\"synonym for \f4/dev/fd/0\fP, \f4/dev/fd/1\fP for
|
|
.\"\f4/dev/fd/1\fP, and \f4/dev/fd/2\fP for \f4/dev/fd/2\fP.
|
|
.SH SEE ALSO
|
|
\f4open\fP(2), \f4dup\fP(2)
|
|
.SH DIAGNOSTICS
|
|
\f4open\fP(2) returns \-1 and \f4EBADF\fP
|
|
if the associated file descriptor is not open.
|