aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-02-12 21:42:20 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-02-12 21:42:20 +0300
commit282dce564a6cd33469f6b82ce94582bc4d9121be (patch)
tree3e8dceb6e0489bdddbd15cac22365a5ed6ca68a4
parent5fb6e5041b65150ec1c78d5e39caeb23e2f9a531 (diff)
Rename fdnull() to fdopen_null()
-rw-r--r--libbutl/curl.cxx8
-rw-r--r--libbutl/curl.mxx2
-rw-r--r--libbutl/fdstream.cxx4
-rw-r--r--libbutl/fdstream.mxx4
-rw-r--r--libbutl/openssl.cxx12
-rw-r--r--libbutl/process.cxx6
-rw-r--r--libbutl/process.mxx2
-rw-r--r--tests/backtrace/driver.cxx2
-rw-r--r--tests/curl/driver.cxx8
-rw-r--r--tests/process-run/driver.cxx6
-rw-r--r--tests/progress/driver.cxx5
11 files changed, 30 insertions, 29 deletions
diff --git a/libbutl/curl.cxx b/libbutl/curl.cxx
index 75ddfdb..ac3d0cb 100644
--- a/libbutl/curl.cxx
+++ b/libbutl/curl.cxx
@@ -53,7 +53,7 @@ namespace butl
case ftp_get:
case http_get:
{
- d.pipe.in = fdnull (); // /dev/null
+ d.pipe.in = fdopen_null (); // /dev/null
return pipe (d.pipe);
}
}
@@ -93,7 +93,7 @@ namespace butl
}
else
{
- d.pipe.in = fdnull (); // /dev/null
+ d.pipe.in = fdopen_null (); // /dev/null
r = pipe (d.pipe);
}
@@ -121,7 +121,7 @@ namespace butl
case ftp_put:
case http_post: // May or may not produce output.
{
- d.pipe.out = fdnull ();
+ d.pipe.out = fdopen_null ();
return pipe (d.pipe); // /dev/null
}
}
@@ -153,7 +153,7 @@ namespace butl
{
d.options.push_back ("-o");
d.options.push_back (f.string ().c_str ());
- d.pipe.out = fdnull (); // /dev/null
+ d.pipe.out = fdopen_null (); // /dev/null
r = pipe (d.pipe);
}
diff --git a/libbutl/curl.mxx b/libbutl/curl.mxx
index 408c06c..03aac99 100644
--- a/libbutl/curl.mxx
+++ b/libbutl/curl.mxx
@@ -70,7 +70,7 @@ LIBBUTL_MODEXPORT namespace butl
// "http://example.org");
//
// curl (nullfd,
- // fdnull (), // Write result to /dev/null.
+ // fdopen_null (), // Write result to /dev/null.
// 2,
// curl::get,
// "tftp://localhost/foo");
diff --git a/libbutl/fdstream.cxx b/libbutl/fdstream.cxx
index 365174d..b58240c 100644
--- a/libbutl/fdstream.cxx
+++ b/libbutl/fdstream.cxx
@@ -1217,7 +1217,7 @@ namespace butl
}
auto_fd
- fdnull ()
+ fdopen_null ()
{
int fd (open ("/dev/null", O_RDWR | O_CLOEXEC));
@@ -1483,7 +1483,7 @@ namespace butl
}
auto_fd
- fdnull (bool temp)
+ fdopen_null (bool temp)
{
// No need to translate \r\n before sending it to void.
//
diff --git a/libbutl/fdstream.mxx b/libbutl/fdstream.mxx
index 41b8748..0d56131 100644
--- a/libbutl/fdstream.mxx
+++ b/libbutl/fdstream.mxx
@@ -812,10 +812,10 @@ LIBBUTL_MODEXPORT namespace butl
//
#ifndef _WIN32
LIBBUTL_SYMEXPORT auto_fd
- fdnull ();
+ fdopen_null ();
#else
LIBBUTL_SYMEXPORT auto_fd
- fdnull (bool temp = false);
+ fdopen_null (bool temp = false);
#endif
struct fdpipe
diff --git a/libbutl/openssl.cxx b/libbutl/openssl.cxx
index ecbebcd..8741b35 100644
--- a/libbutl/openssl.cxx
+++ b/libbutl/openssl.cxx
@@ -38,7 +38,7 @@ namespace butl
process::pipe openssl::
map_in (nullfd_t, io_data& d)
{
- d.pipe.in = fdnull (); // /dev/null
+ d.pipe.in = fdopen_null (); // /dev/null
return pipe (d.pipe);
}
@@ -59,7 +59,7 @@ namespace butl
{
d.options.push_back ("-in");
d.options.push_back (f.string ().c_str ());
- d.pipe.in = fdnull (); // /dev/null
+ d.pipe.in = fdopen_null (); // /dev/null
r = pipe (d.pipe);
}
@@ -77,7 +77,7 @@ namespace butl
? fdopen_mode::binary
: fdopen_mode::none);
pipe r (d.pipe);
-
+
out.open (move (d.pipe.out));
return r;
}
@@ -85,7 +85,7 @@ namespace butl
process::pipe openssl::
map_out (nullfd_t, io_data& d)
{
- d.pipe.out = fdnull ();
+ d.pipe.out = fdopen_null ();
return pipe (d.pipe); // /dev/null
}
@@ -106,7 +106,7 @@ namespace butl
{
d.options.push_back ("-out");
d.options.push_back (f.string ().c_str ());
- d.pipe.out = fdnull (); // /dev/null
+ d.pipe.out = fdopen_null (); // /dev/null
r = pipe (d.pipe);
}
@@ -124,7 +124,7 @@ namespace butl
? fdopen_mode::binary
: fdopen_mode::none);
pipe r (d.pipe);
-
+
in.open (move (d.pipe.in), fdstream_mode::skip);
return r;
}
diff --git a/libbutl/process.cxx b/libbutl/process.cxx
index 74f04fa..d4322a9 100644
--- a/libbutl/process.cxx
+++ b/libbutl/process.cxx
@@ -135,7 +135,7 @@ import std.threading;
#endif
import butl.utility; // icasecmp()
-import butl.fdstream; // fdnull()
+import butl.fdstream; // fdopen_null()
#else
#include <libbutl/utility.mxx>
#include <libbutl/fdstream.mxx>
@@ -412,7 +412,7 @@ namespace butl
{
try
{
- return fdnull ();
+ return fdopen_null ();
}
catch (const ios_base::failure& e)
{
@@ -1510,7 +1510,7 @@ namespace butl
//
try
{
- return fdnull (true);
+ return fdopen_null (true /* temp */);
}
catch (const ios_base::failure& e)
{
diff --git a/libbutl/process.mxx b/libbutl/process.mxx
index f31c362..1f378c4 100644
--- a/libbutl/process.mxx
+++ b/libbutl/process.mxx
@@ -530,7 +530,7 @@ LIBBUTL_MODEXPORT namespace butl
// make stdin read from /dev/null, stdout redirect to stderr, and inherit
// the parent's stderr.
//
- // process_run (fdnull (), 2, 2, ...)
+ // process_run (fdopen_null (), 2, 2, ...)
//
// The P argument is the program path. It can be anything that can be passed
// to process::path_search() (const char*, std::string, path) or the
diff --git a/tests/backtrace/driver.cxx b/tests/backtrace/driver.cxx
index 442d1e6..d998942 100644
--- a/tests/backtrace/driver.cxx
+++ b/tests/backtrace/driver.cxx
@@ -121,7 +121,7 @@ main (int argc, const char* argv[])
// Run as a parent.
//
- auto_fd null (fdnull ());
+ auto_fd null (fdopen_null ());
process_exit pe1 (process_run (0 /* stdin */,
1 /* stdout */,
quiet ? null.get () : 2 /* stderr */,
diff --git a/tests/curl/driver.cxx b/tests/curl/driver.cxx
index f2af782..18ed1e6 100644
--- a/tests/curl/driver.cxx
+++ b/tests/curl/driver.cxx
@@ -55,7 +55,7 @@ tftp ()
// GET non-existent.
//
{
- curl c (p, nullfd, fdnull (), 2, curl::get, u + "/foo");
+ curl c (p, nullfd, fdopen_null (), 2, curl::get, u + "/foo");
assert (!c.wait ());
}
@@ -88,7 +88,7 @@ tftp ()
// GET to /dev/null.
//
{
- curl c (p, nullfd, fdnull (), 2, curl::get, u + "/foo");
+ curl c (p, nullfd, fdopen_null (), 2, curl::get, u + "/foo");
assert (c.wait ());
}
}
@@ -103,14 +103,14 @@ http ()
// GET non-existent.
//
{
- curl c (p, nullfd, fdnull (), 2, curl::get, u + "/bogus");
+ curl c (p, nullfd, fdopen_null (), 2, curl::get, u + "/bogus");
assert (!c.wait ());
}
// GET to /dev/null.
//
{
- curl c (p, nullfd, fdnull (), 2, curl::get, u);
+ curl c (p, nullfd, fdopen_null (), 2, curl::get, u);
assert (c.wait ());
}
diff --git a/tests/process-run/driver.cxx b/tests/process-run/driver.cxx
index 14797c4..94b6e00 100644
--- a/tests/process-run/driver.cxx
+++ b/tests/process-run/driver.cxx
@@ -94,9 +94,9 @@ main (int argc, const char* argv[])
// Stream conversion and redirection.
//
- assert (run (fdnull (), 1, 2, p, "-c", "-i"));
- assert (run (fdnull (), 2, 2, p, "-c", "-o", "abc"));
- assert (run (fdnull (), 1, 1, p, "-c", "-e", "abc"));
+ assert (run (fdopen_null (), 1, 2, p, "-c", "-i"));
+ assert (run (fdopen_null (), 2, 2, p, "-c", "-o", "abc"));
+ assert (run (fdopen_null (), 1, 1, p, "-c", "-e", "abc"));
{
fdpipe pipe (fdopen_pipe ());
diff --git a/tests/progress/driver.cxx b/tests/progress/driver.cxx
index 2ec310b..2a0b647 100644
--- a/tests/progress/driver.cxx
+++ b/tests/progress/driver.cxx
@@ -37,7 +37,7 @@ import butl.optional; // @@ MOD Clang should not be necessary.
import butl.small_vector; // @@ MOD Clang should not be necessary.
#else
#include <libbutl/process.mxx>
-#include <libbutl/fdstream.mxx> // fdnull(), stderr_fd()
+#include <libbutl/fdstream.mxx> // fdopen_null(), stderr_fd()
#include <libbutl/diagnostics.mxx>
#endif
@@ -112,7 +112,8 @@ main (int argc, const char* argv[])
}
process pr (!no_child
- ? process_start (fdnull (), fdnull (), 2, argv[0], "-c")
+ ? process_start (fdopen_null (), fdopen_null (), 2,
+ argv[0], "-c")
: process (process_exit (0))); // Exited normally.
for (size_t i (100); i != 0; --i)