BSD 3 development
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Thu, 15 Nov 1979 16:41:29 +0000 (08:41 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Thu, 15 Nov 1979 16:41:29 +0000 (08:41 -0800)
Work on file usr/man/man2/dup.2

Synthesized-from: 3bsd

usr/man/man2/dup.2 [new file with mode: 0644]

diff --git a/usr/man/man2/dup.2 b/usr/man/man2/dup.2
new file mode 100644 (file)
index 0000000..42450d3
--- /dev/null
@@ -0,0 +1,68 @@
+.TH DUP 2 
+.SH NAME
+dup, dup2 \- duplicate an open file descriptor
+.SH SYNOPSIS
+.B dup(fildes)
+.br
+.B int fildes;
+.PP
+.B dup2(fildes, fildes2)
+.br
+.B int fildes, fildes2;
+.SH DESCRIPTION
+Given
+a file descriptor returned from
+an
+.I open,
+.I pipe,
+or
+.I creat
+call,
+.I dup
+allocates another file descriptor
+synonymous
+with
+the original.
+The new file descriptor is returned.
+.PP
+In the second form of the call,
+.I fildes
+is a file descriptor referring to an open file, and
+.I fildes2
+is a non-negative integer less than the maximum value
+allowed for file descriptors (approximately 19).
+.I Dup2
+causes
+.I fildes2
+to refer to the same file as
+.I fildes.
+If
+.I fildes2
+already referred to an open file, it is closed first.
+.SH "SEE ALSO"
+creat(2), open(2), close(2), pipe(2)
+.SH DIAGNOSTICS
+The value \-1 is returned if:
+the given file descriptor is invalid;
+there are already too many open files.
+.SH "ASSEMBLER (PDP-11)"
+(dup = 41.)
+.br
+(file descriptor in r0)
+.br
+(new file descriptor in r1)
+.br
+.B sys dup
+.br
+(file descriptor in r0)
+.PP
+The
+.I dup2
+entry is implemented by adding 0100 to
+.I fildes.
+.SH BUGS
+Dup2 fails if
+.I fildes2
+was
+.I vread
+from and some of the pages have not been referenced.