File:  [CSRG BSD Unix] / 43BSDReno / share / man / man4 / fd.4
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:57 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43reno
BSD 4.3reno

.\" Copyright (c) 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted
.\" provided that: (1) source distributions retain this entire copyright
.\" notice and comment, and (2) distributions including binaries display
.\" the following acknowledgement:  ``This product includes software
.\" developed by the University of California, Berkeley and its contributors''
.\" in the documentation or other materials provided with the distribution
.\" and in all advertising materials mentioning features or use of this
.\" software. Neither the name of the University nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\"	@(#)fd.4	5.1 (Berkeley) 5/10/90
.\"
.TH FD 4 "May 10, 1990"
.UC 7
.SH NAME
fd, stdin, stdout, stderr \- file descriptor files
.SH DESCRIPTION
The files
.I /dev/fd/0
through
.I /dev/fd/#
refer to file descriptors which can be accessed through the file
system.
If the file descriptor is open and the mode the file is being opened
with is a subset of the mode of the existing descriptor, the call:
.sp
.RS
fd = open("/dev/fd/0", mode);
.RE
.sp
and the call:
.sp
.RS
fd = fcntl(0, F_DUPFD, 0);
.RE
.sp
are equivalent.
.PP
Opening the files
.IR /dev/stdin ,
.I /dev/stdout
and
.I /dev/stderr
is equivalent to the following calls:
.sp
.RS
fd = fcntl(STDIN_FILENO,  F_DUPFD, 0);
.br
fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
.br
fd = fcntl(STDERR_FILENO, F_DUPFD, 0);
.RE
.PP
Flags to the
.IR open (2)
call other than O_RDONLY, O_WRONLY and O_RDWR are ignored.
.SH FILES
/dev/fd/#
.br
/dev/stdin
.br
/dev/stdout
.br
/dev/stderr
.SH SEE ALSO
tty(4)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.