plan9port/man/man3/dup.3

40 lines
695 B
Groff
Raw Permalink Normal View History

2004-04-10 18:53:55 +00:00
.TH DUP 3
.SH NAME
dup \- duplicate an open file descriptor
.SH SYNOPSIS
.B #include <u.h>
.br
.B #include <libc.h>
.PP
.B
int dup(int oldfd, int newfd)
.SH DESCRIPTION
Given a file descriptor,
.IR oldfd ,
referring to an open file,
.I dup
returns a new file descriptor referring to the same file.
.PP
If
.I newfd
is \-1 the system chooses the lowest available file descriptor.
Otherwise,
.I dup
will use
.I newfd
for the new file descriptor
(closing any old file associated with
.IR newfd ).
.SH SOURCE
2005-01-11 17:37:33 +00:00
.B \*9/src/lib9/dup.c
2004-04-10 18:53:55 +00:00
.SH DIAGNOSTICS
Sets
.IR errstr .
2005-01-03 06:40:20 +00:00
.SH BUGS
2005-01-13 04:49:19 +00:00
To avoid name conflicts with the underlying system,
.I dup
is a preprocessor macro defined as
.IR p9dup ;
see
.MR intro (3) .