File:  [Research Unix] / researchv10dc / man / adm / man2 / dup.2
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:34 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Dan Cross

.TH DUP 2
.CT 2 file_io
.SH NAME
dup, dup2 \(mi duplicate an open file descriptor
.SH SYNOPSIS
.nf
.B int dup(fildes)
.B int fildes;
.PP
.B int dup2(fildes, fildes2)
.B int fildes, fildes2;
.fi
.SH DESCRIPTION
Given
a file descriptor
.I dup
allocates another file descriptor
synonymous
with
the original.
The new file descriptor is returned.
.PP
In
.IR dup2 ,
.I fildes
is a file descriptor referring to an open file, and
.I fildes2
is an integer in the range of legal file descriptors.
.I Dup2
causes
.I fildes2
to refer to the same file
and returns 
.I fildes2.
If
.I fildes2
already referred to another open file, it is closed first.
.SH "SEE ALSO"
.IR open (2), 
.IR pipe (2), 
.IR fd (4)
.SH DIAGNOSTICS
.BR EBADF ,
.BR EMFILE
.SH BUGS
.I Dup
of a file descriptor greater than 63
turns into a
.I dup2
with a random second argument.

unix.superglobalmegacorp.com

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