diff options
Diffstat (limited to 'usr/src/man/man4fs/fd.4fs')
-rw-r--r-- | usr/src/man/man4fs/fd.4fs | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/usr/src/man/man4fs/fd.4fs b/usr/src/man/man4fs/fd.4fs new file mode 100644 index 0000000000..4b51bff7ac --- /dev/null +++ b/usr/src/man/man4fs/fd.4fs @@ -0,0 +1,84 @@ +.\" +.\" Copyright (c) 1993, Sun Microsystems, Inc. All Rights Reserved. +.\" Copyright 1989 AT&T +.\" Copyright 2021 Oxide Computer Company +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" +.Dd July 3, 1990 +.Dt FD 4FS +.Os +.Sh NAME +.Nm fd , +.Nm stdin , +.Nm stdout , +.Nm stderr +.Nd file descriptor files +.Sh DESCRIPTION +These files, conventionally called +.Pa /dev/fd/0 , +.Pa /dev/fd/1 , +.Pa /dev/fd/2 , +and so on, refer to files accessible through file descriptors. +If file descriptor +.Em n +is open, these two system calls have the same +effect: +.Bd -literal -offset indent +fd = open("/dev/fd/<n>", mode); +fd = dup(n); +.Ed +.Pp +On these files +.Xr creat 2 +is equivalent to +.Xr open 2 , +and +.Fa mode +is +ignored. +As with +.Xr dup 2 , +subsequent reads or writes on +.Em fd +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: +.Pa /dev/stdin +is a synonym +for +.Pa /dev/fd/0 , +.Pa /dev/stdout +for +.Pa /dev/fd/1 , +and +.Pa /dev/stderr +for +.Pa /dev/fd/2 . +.Sh DIAGNOSTICS +.Xr open 2 +returns +.Sy -1 +and +.Va errno +is set to +.Er EBADF +if the associated file descriptor is not open. +.Sh SEE ALSO +.Xr creat 2 , +.Xr dup 2 , +.Xr open 2 |