blob: e8c7c8b288251f83b6eae40f94dedc89b2574a24 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
.pa 1
.he 'DUP (II)'1/15/73'DUP (II)'
.ti 0
NAME dup -- duplicate an open file descriptor
.sp
.ti 0
SYNOPSIS (file descriptor in r0)
.br
sys dup / dup = 41.; not in assembler
.br
(file descriptor in r0)
.sp
.ti 0
DESCRIPTION Given
a file descriptor returned from
an open or creat call,
dup___
will allocate another file descriptor
synonymous
with
the original.
The new file descriptor is returned in r0.
.sp
Dup___
is used more to manipulate the value
of file descriptors
than to genuinely
duplicate a file descriptor.
Since the algorithm to allocate
file descriptors
is known to use the
lowest available
value between 0 and 9,
combinations of dup___
and close_____ can be
used to
manipulate file descriptors
in a general way.
This is handy for
manipulating standard input and/or
standard output.
.sp
.ti 0
SEE ALSO creat(II), open(II), close(II)
.sp
.ti 0
DIAGNOSTICS The
error bit (c-bit)
is set if:
the given file descriptor is invalid;
there are already 10 open files.
.sp
.ti 0
BUGS --
|