Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_fixcpp/sys/man/3/dup – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
.TH DUP 3 
2
.SH NAME
3
dup \- dups of open files
4
.SH SYNOPSIS
5
.nf
6
.B bind #d /fd
7
 
8
.B /fd/0
9
.B /fd/0ctl
10
.B /fd/1
11
.B /fd/1ctl
12
\&...
13
.fi
14
.SH DESCRIPTION
15
The
16
.I dup
17
device serves a one-level directory containing files whose
18
names are decimal numbers.
19
Each such file also has an associated control file.
20
A file of name
21
.I n
22
corresponds to open file descriptor
23
.I n
24
in the current process.
25
.PP
26
An
27
.IR open (2)
28
of file
29
.I n
30
results in a file descriptor identical to
31
what would be returned from a system call
32
.IB dup ( n ,
33
.BR -1) .
34
Note that the result is no longer a file in the
35
.I dup
36
device.
37
.PP
38
The
39
.I stat
40
operation returns information about the device file, not the open file it points to.
41
A stat of
42
.BI #d/ n
43
will contain
44
.I n
45
for the name, 0 for the length, and 0400, 0200, or 0600
46
for the mode, depending on whether the dup target is open
47
for reading, writing, or both.
48
.PP
49
A file of name
50
.IB n ctl
51
may be read to discover the properties of the associated file descriptor, in format identical to that of the
52
.B fd
53
file in
54
.IR proc (3).
55
.SH SEE ALSO
56
.IR dup (2)
57
.SH SOURCE
58
.B /sys/src/9/port/devdup.c