summaryrefslogtreecommitdiff
path: root/man/fd.3
diff options
context:
space:
mode:
Diffstat (limited to 'man/fd.3')
-rw-r--r--man/fd.379
1 files changed, 79 insertions, 0 deletions
diff --git a/man/fd.3 b/man/fd.3
new file mode 100644
index 0000000..b22338d
--- /dev/null
+++ b/man/fd.3
@@ -0,0 +1,79 @@
+.TH qlibs: fd 3
+.SH NAME
+fd \- duplicate, move or close a file descriptor
+.SH SYNTAX
+.B #include \(dqfd.h\(dq
+
+int \fBfd_copy\fP(int \fIto\fR,int \fIfrom\fR);
+.br
+int \fBfd_move\fP(int \fIto\fR,int \fIfrom\fR);
+.br
+int \fBfd_coe\fP(int \fIfd\fR);
+.SH DESCRIPTION
+.B fd_copy
+copies
+descriptor
+.I from
+to descriptor
+.IR to .
+If
+.I to
+was already open,
+.B fd_copy
+closes it.
+.B fd_copy
+always leaves
+.I from
+intact;
+if
+.I to
+and
+.I from
+are the same number,
+.B fd_copy
+does nothing.
+.B fd_copy
+does not guarantee that
+.I to
+will remain open, if it was open, in case of error.
+
+.B fd_move
+moves
+descriptor
+.I from
+to descriptor
+.IR to .
+If
+.I to
+was already open,
+.B fd_move
+closes it.
+If the move is successful,
+.B fd_move
+closes
+.IR from .
+Exception:
+if
+.I to
+and
+.I from
+are the same number,
+.B fd_move
+does nothing.
+
+.B fd_coe
+closes
+.IR fd .
+.SH "RETURN CODES"
+.BR fd_copy ,
+.BR fd_move ,
+and
+.B fd_coe
+return
+.I 0
+on success,
+and
+.I -1
+on error.
+.SH "SEE ALSO"
+dup(2), fcntl(2)