From 265c3c71a82906de252637ecbdacf23a99b2ea0c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 3 Jun 2016 14:20:50 +0300 Subject: Add fdnull() --- butl/fdstream | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'butl/fdstream') diff --git a/butl/fdstream b/butl/fdstream index f144578..0be3708 100644 --- a/butl/fdstream +++ b/butl/fdstream @@ -142,7 +142,7 @@ namespace butl fdtranslate stdout_fdmode (fdtranslate); fdtranslate stderr_fdmode (fdtranslate); - // Low-level, nothrow file descriptor API. Primarily useful in tests. + // Low-level, nothrow file descriptor API. // // Close the file descriptor. Return true on success, set errno and return @@ -150,6 +150,15 @@ namespace butl // bool fdclose (int) noexcept; + + // Open the null device (e.g., /dev/null) that discards all data written to + // it and provides no data for read operations (i.e., yelds EOF on read). + // Return file descriptor on success, set errno and return -1 otherwise. + // Note that it's the caller's responsibility to close the returned file + // descriptor. + // + int + fdnull () noexcept; } #endif // BUTL_FDSTREAM -- cgit v1.1