blob: a9378dcee474e501355c65b36cf31f8618cfd587 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
.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
.B \*9/src/lib9/dup.c
.SH DIAGNOSTICS
Sets
.IR errstr .
.SH BUGS
.I Dup
is a macro for
.I p9dup
to avoid name conflicts with the Unix function; see
.IR intro (3).
|