'\" te .\" Copyright (c) 1993, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 1989 AT&T .TH fd 4 "3 Jul 1990" "SunOS 5.11" "File Formats" .SH NAME fd \- file descriptor files .SH DESCRIPTION .sp .LP These files, conventionally called \fB/dev/fd/0\fR, \fB/dev/fd/1\fR, \fB/dev/fd/2\fR, and so on, refer to files accessible through file descriptors. If file descriptor \fIn\fR is open, these two system calls have the same effect: .sp .in +2 .nf \fBfd = open("/dev/fd/\fR\fIn\fR",mode); fd = dup(\fIn\fR); .fi .in -2 .sp .sp .LP On these files \fBcreat\fR(2) is equivalent to \fBopen\fR, and \fBmode\fR is ignored. As with \fBdup\fR, subsequent reads or writes on \fBfd\fR fail unless the original file descriptor allows the operations. .sp .LP For convenience in referring to standard input, standard output, and standard error, an additional set of names is provided: \fB/dev/stdin\fR is a synonym for \fB/dev/fd/0\fR, \fB/dev/stdout\fR for \fB/dev/fd/1\fR, and \fB/dev/stderr\fR for \fB/dev/fd/2\fR. .SH SEE ALSO .sp .LP \fBcreat\fR(2), \fBdup\fR(2), \fBopen\fR(2) .SH DIAGNOSTICS .sp .LP \fBopen\fR(2) returns \fB\(mi1\fR and \fBEBADF\fR if the associated file descriptor is not open.