aboutsummaryrefslogtreecommitdiff
path: root/butl/fdstream
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-11-08 16:09:37 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-11-08 16:09:37 +0300
commit2940072ad2e4a074da9b091fce89adc50e29c6e0 (patch)
treeb2cb66ed02762d525d2b82aecf6c95db8e119401 /butl/fdstream
parentce9d743824be796471bae9b57c0185ef8ec1b804 (diff)
Add fddup()
Diffstat (limited to 'butl/fdstream')
-rw-r--r--butl/fdstream11
1 files changed, 9 insertions, 2 deletions
diff --git a/butl/fdstream b/butl/fdstream
index 289d925..d3dbef7 100644
--- a/butl/fdstream
+++ b/butl/fdstream
@@ -52,8 +52,9 @@ namespace butl
void
reset (int fd = -1) noexcept;
- // Close an open file descriptor. Throw ios::failure on failure. The object
- // become unopened whenever the exception is thrown or not.
+ // Close an open file descriptor. Throw ios::failure on the underlying OS
+ // error. Reset the descriptor to -1 whenever the exception is thrown or
+ // not.
//
void
close ();
@@ -498,6 +499,12 @@ namespace butl
permissions::rg | permissions::wg |
permissions::ro | permissions::wo);
+ // Duplicate an open file descriptor. Throw ios::failure on the underlying
+ // OS error.
+ //
+ LIBBUTL_EXPORT auto_fd
+ fddup (int fd);
+
// Set the translation mode for the file descriptor. Return the previous
// mode on success, throw ios::failure otherwise.
//