From 2940072ad2e4a074da9b091fce89adc50e29c6e0 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 8 Nov 2016 16:09:37 +0300 Subject: Add fddup() --- butl/fdstream | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'butl/fdstream') 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. // -- cgit v1.1