aboutsummaryrefslogtreecommitdiff
path: root/butl/fdstream
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-06-03 14:20:50 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-06-03 21:18:22 +0300
commit265c3c71a82906de252637ecbdacf23a99b2ea0c (patch)
treeed54306dedb101208a0fea220ec230d9f0e1c2da /butl/fdstream
parent08c7238ae6be49d6eb51099107538f5a4522f9dd (diff)
Add fdnull()
Diffstat (limited to 'butl/fdstream')
-rw-r--r--butl/fdstream11
1 files changed, 10 insertions, 1 deletions
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