2
0
mirror of https://github.com/boostorg/process.git synced 2026-01-19 04:22:15 +00:00

removed boost::system:: scope spec for error_code.

This commit is contained in:
Klemens Morgenstern
2024-12-20 19:05:07 +08:00
parent 02a9ec0961
commit d2d13f424f
11 changed files with 89 additions and 87 deletions

View File

@@ -287,7 +287,7 @@ struct basic_process_handle_win
sl.assign(
[&h](asio::cancellation_type ct)
{
boost::system::error_code ec;
error_code ec;
h.cancel(ec);
});
handle.async_wait(std::move(self));

View File

@@ -105,8 +105,8 @@ typedef struct {
#else
#include <poppack.h>
#endif
BOOST_PROCESS_V2_DECL std::wstring cwd_cmd_from_proc(HANDLE proc, int type, boost::system::error_code & ec);
BOOST_PROCESS_V2_DECL HANDLE open_process_with_debug_privilege(boost::process::v2::pid_type pid, boost::system::error_code & ec);
BOOST_PROCESS_V2_DECL std::wstring cwd_cmd_from_proc(HANDLE proc, int type, error_code & ec);
BOOST_PROCESS_V2_DECL HANDLE open_process_with_debug_privilege(boost::process::v2::pid_type pid, error_code & ec);
#endif
} // namespace ext

View File

@@ -42,19 +42,19 @@ constexpr static pid_type root_pid = 1;
BOOST_PROCESS_V2_DECL pid_type current_pid();
/// List all available pids.
BOOST_PROCESS_V2_DECL std::vector<pid_type> all_pids(boost::system::error_code & ec);
BOOST_PROCESS_V2_DECL std::vector<pid_type> all_pids(error_code & ec);
/// List all available pids.
BOOST_PROCESS_V2_DECL std::vector<pid_type> all_pids();
// return parent pid of pid.
BOOST_PROCESS_V2_DECL pid_type parent_pid(pid_type pid, boost::system::error_code & ec);
BOOST_PROCESS_V2_DECL pid_type parent_pid(pid_type pid, error_code & ec);
// return parent pid of pid.
BOOST_PROCESS_V2_DECL pid_type parent_pid(pid_type pid);
// return child pids of pid.
BOOST_PROCESS_V2_DECL std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec);
BOOST_PROCESS_V2_DECL std::vector<pid_type> child_pids(pid_type pid, error_code & ec);
// return child pids of pid.
BOOST_PROCESS_V2_DECL std::vector<pid_type> child_pids(pid_type pid);

View File

@@ -248,7 +248,7 @@ struct basic_popen : basic_process<Executor>
*
* @returns The number of bytes written.
*
* @throws boost::system::system_error Thrown on failure. An error code of
* @throws system_error Thrown on failure. An error code of
* boost::asio::error::eof indicates that the connection was closed by the
* subprocess.
*
@@ -289,7 +289,7 @@ struct basic_popen : basic_process<Executor>
*/
template <typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buffers,
boost::system::error_code& ec)
error_code& ec)
{
return stdin_.write_some(buffers, ec);
}
@@ -311,7 +311,7 @@ struct basic_popen : basic_process<Executor>
* @ref yield_context, or a function object with the correct completion
* signature. The function signature of the completion handler must be:
* @code void handler(
* const boost::system::error_code& error, // Result of operation.
* const error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes written.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
@@ -320,7 +320,7 @@ struct basic_popen : basic_process<Executor>
* manner equivalent to using boost::asio::post().
*
* @par Completion Signature
* @code void(boost::system::error_code, std::size_t) @endcode
* @code void(error_code, std::size_t) @endcode
*
* @note The write operation may not transmit all of the data to the peer.
* Consider using the @ref async_write function if you need to ensure that all
@@ -336,7 +336,7 @@ struct basic_popen : basic_process<Executor>
* std::vector.
*/
template <typename ConstBufferSequence,
BOOST_PROCESS_V2_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t))
BOOST_PROCESS_V2_COMPLETION_TOKEN_FOR(void (error_code, std::size_t))
WriteToken = net::default_completion_token_t<executor_type>>
auto async_write_some(const ConstBufferSequence& buffers,
WriteToken && token = net::default_completion_token_t<executor_type>())
@@ -356,7 +356,7 @@ struct basic_popen : basic_process<Executor>
*
* @returns The number of bytes read.
*
* @throws boost::system::system_error Thrown on failure. An error code of
* @throws system_error Thrown on failure. An error code of
* boost::asio::error::eof indicates that the connection was closed by the
* peer.
*
@@ -399,7 +399,7 @@ struct basic_popen : basic_process<Executor>
*/
template <typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence& buffers,
boost::system::error_code& ec)
error_code& ec)
{
return stdout_.read_some(buffers, ec);
}
@@ -421,7 +421,7 @@ struct basic_popen : basic_process<Executor>
* @ref yield_context, or a function object with the correct completion
* signature. The function signature of the completion handler must be:
* @code void handler(
* const boost::system::error_code& error, // Result of operation.
* const error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes read.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
@@ -430,7 +430,7 @@ struct basic_popen : basic_process<Executor>
* manner equivalent to using boost::asio::post().
*
* @par Completion Signature
* @code void(boost::system::error_code, std::size_t) @endcode
* @code void(error_code, std::size_t) @endcode
*
* @note The read operation may not read all of the requested number of bytes.
* Consider using the @ref async_read function if you need to ensure that the
@@ -448,7 +448,7 @@ struct basic_popen : basic_process<Executor>
* std::vector.
*/
template <typename MutableBufferSequence,
BOOST_PROCESS_V2_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t))
BOOST_PROCESS_V2_COMPLETION_TOKEN_FOR(void (error_code, std::size_t))
ReadToken = net::default_completion_token_t<executor_type>>
auto async_read_some(const MutableBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(ReadToken) token

View File

@@ -133,14 +133,14 @@ shell cmd(HANDLE proc, error_code & ec)
shell cmd(HANDLE proc)
{
boost::system::error_code ec;
error_code ec;
auto res = cmd(proc, ec);
if (ec)
detail::throw_error(ec, "cmd");
return res;
}
shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
shell cmd(boost::process::v2::pid_type pid, error_code & ec)
{
struct del
{
@@ -162,7 +162,7 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
#elif (defined(__APPLE__) && defined(__MACH__)) && !TARGET_OS_IOS
shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
shell cmd(boost::process::v2::pid_type pid, error_code & ec)
{
int mib[3] = {CTL_KERN, KERN_ARGMAX, 0};
int argmax = 0;
@@ -213,7 +213,7 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
#elif (defined(__linux__) || defined(__ANDROID__))
shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
shell cmd(boost::process::v2::pid_type pid, error_code & ec)
{
std::string procargs;
procargs.resize(4096);
@@ -269,7 +269,7 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
#elif (defined(__FreeBSD__) || defined(__DragonFly__))
shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
shell cmd(boost::process::v2::pid_type pid, error_code & ec)
{
int cntp = 0;
kinfo_proc *proc_info = nullptr;
@@ -301,7 +301,7 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
#elif defined(__NetBSD__)
shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
shell cmd(boost::process::v2::pid_type pid, error_code & ec)
{
int cntp = 0;
kinfo_proc2 *proc_info = nullptr;
@@ -332,7 +332,7 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
#elif defined(__OpenBSD__)
shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
shell cmd(boost::process::v2::pid_type pid, error_code & ec)
{
int cntp = 0;
kinfo_proc *proc_info = nullptr;
@@ -362,7 +362,7 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
#elif defined(__sun)
shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
shell cmd(boost::process::v2::pid_type pid, error_code & ec)
{
char **cmd = nullptr;
proc *proc_info = nullptr;
@@ -403,7 +403,7 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
}
#else
filesystem::path cmd(boost::process::v2::pid_type, boost::system::error_code & ec)
filesystem::path cmd(boost::process::v2::pid_type, error_code & ec)
{
BOOST_PROCESS_V2_ASSIGN_EC(ec, ENOTSUP, system_category());
return "";
@@ -412,7 +412,7 @@ filesystem::path cmd(boost::process::v2::pid_type, boost::system::error_code & e
shell cmd(boost::process::v2::pid_type pid)
{
boost::system::error_code ec;
error_code ec;
auto res = cmd(pid, ec);
if (ec)
detail::throw_error(ec, "cmd");

View File

@@ -67,7 +67,7 @@ namespace ext {
#if defined(BOOST_PROCESS_V2_WINDOWS)
filesystem::path cwd(HANDLE proc, boost::system::error_code & ec)
filesystem::path cwd(HANDLE proc, error_code & ec)
{
auto buffer = boost::process::v2::detail::ext::cwd_cmd_from_proc(proc, 1/*=MEMCWD*/, ec);
if (!buffer.empty())
@@ -77,7 +77,7 @@ filesystem::path cwd(HANDLE proc, boost::system::error_code & ec)
return "";
}
filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path cwd(boost::process::v2::pid_type pid, error_code & ec)
{
struct del
{
@@ -96,7 +96,7 @@ filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code
filesystem::path cwd(HANDLE proc)
{
boost::system::error_code ec;
error_code ec;
auto res = cwd(proc, ec);
if (ec)
detail::throw_error(ec, "cwd");
@@ -105,7 +105,7 @@ filesystem::path cwd(HANDLE proc)
#elif (defined(__APPLE__) && defined(__MACH__)) && !TARGET_OS_IOS
filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path cwd(boost::process::v2::pid_type pid, error_code & ec)
{
proc_vnodepathinfo vpi;
if (proc_pidinfo(pid, PROC_PIDVNODEPATHINFO, 0, &vpi, sizeof(vpi)) > 0)
@@ -117,7 +117,7 @@ filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code
#elif (defined(__linux__) || defined(__ANDROID__) || defined(__sun))
filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path cwd(boost::process::v2::pid_type pid, error_code & ec)
{
#if (defined(__linux__) || defined(__ANDROID__))
return filesystem::canonical(
@@ -132,7 +132,7 @@ filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code
#elif defined(__FreeBSD__)
filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path cwd(boost::process::v2::pid_type pid, error_code & ec)
{
filesystem::path path;
struct kinfo_file kif;
@@ -155,7 +155,7 @@ filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code
#elif defined(__DragonFly__)
filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path cwd(boost::process::v2::pid_type pid, error_code & ec)
{
filesystem::path path;
char buffer[PATH_MAX];
@@ -172,7 +172,7 @@ filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code
#elif (defined(__NetBSD__) || defined(__OpenBSD__))
filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path cwd(boost::process::v2::pid_type pid, error_code & ec)
{
filesystem::path path;
#if defined(__NetBSD__)
@@ -200,7 +200,7 @@ filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code
}
#else
filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path cwd(boost::process::v2::pid_type pid, error_code & ec)
{
BOOST_PROCESS_V2_ASSIGN_EC(ec, ENOTSUP, system_category());
return "";
@@ -209,7 +209,7 @@ filesystem::path cwd(boost::process::v2::pid_type pid, boost::system::error_code
filesystem::path cwd(boost::process::v2::pid_type pid)
{
boost::system::error_code ec;
error_code ec;
auto res = cwd(pid, ec);
if (ec)
detail::throw_error(ec, "cwd");

View File

@@ -172,7 +172,7 @@ namespace ext
#if defined(BOOST_PROCESS_V2_WINDOWS)
env_view env(HANDLE proc, boost::system::error_code & ec)
env_view env(HANDLE proc, error_code & ec)
{
wchar_t *buffer = nullptr;
PEB peb;
@@ -221,14 +221,14 @@ env_view env(HANDLE proc, boost::system::error_code & ec)
env_view env(HANDLE handle)
{
boost::system::error_code ec;
error_code ec;
auto res = env(handle, ec);
if (ec)
detail::throw_error(ec, "env");
return res;
}
env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
env_view env(boost::process::v2::pid_type pid, error_code & ec)
{
struct del
{
@@ -248,7 +248,7 @@ env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
#elif (defined(__APPLE___) || defined(__MACH__)) && !TARGET_OS_IOS
env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
env_view env(boost::process::v2::pid_type pid, error_code & ec)
{
int mib[3] = {CTL_KERN, KERN_ARGMAX, 0};
int argmax = 0;
@@ -311,7 +311,7 @@ env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
#elif (defined(__linux__) || defined(__ANDROID__))
env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
env_view env(boost::process::v2::pid_type pid, error_code & ec)
{
std::size_t size = 0;
std::unique_ptr<char, detail::ext::native_env_handle_deleter> procargs{};
@@ -346,7 +346,7 @@ env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
}
#elif defined(__FreeBSD__) || defined(__DragonFly__)
env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
env_view env(boost::process::v2::pid_type pid, error_code & ec)
{
std::vector<char> vec;
int cntp = 0;
@@ -388,7 +388,7 @@ env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
}
#elif defined(__NetBSD__)
env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
env_view env(boost::process::v2::pid_type pid, error_code & ec)
{
std::vector<char> vec;
int cntp = 0;
@@ -427,7 +427,7 @@ env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
return ev;
}
#elif defined(__OpenBSD__)
env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
env_view env(boost::process::v2::pid_type pid, error_code & ec)
{
std::vector<char> vec;
int cntp = 0;
@@ -468,7 +468,7 @@ env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
return ev;
}
#elif defined(__sun)
env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
env_view env(boost::process::v2::pid_type pid, error_code & ec)
{
std::vector<char> vec;
char **env = nullptr;
@@ -518,7 +518,7 @@ env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
env_view env(boost::process::v2::pid_type pid)
{
boost::system::error_code ec;
error_code ec;
auto res = env(pid, ec);
if (ec)
detail::throw_error(ec, "env");

View File

@@ -65,7 +65,7 @@ namespace ext {
filesystem::path exe(HANDLE process_handle)
{
boost::system::error_code ec;
error_code ec;
auto res = exe(process_handle, ec);
if (ec)
detail::throw_error(ec, "exe");
@@ -73,7 +73,7 @@ filesystem::path exe(HANDLE process_handle)
}
filesystem::path exe(HANDLE proc, boost::system::error_code & ec)
filesystem::path exe(HANDLE proc, error_code & ec)
{
#if _WIN32_WINNT >= 0x0600
wchar_t buffer[MAX_PATH];
@@ -91,7 +91,7 @@ filesystem::path exe(HANDLE proc, boost::system::error_code & ec)
return "";
}
filesystem::path exe(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path exe(boost::process::v2::pid_type pid, error_code & ec)
{
if (pid == GetCurrentProcessId())
{
@@ -121,7 +121,7 @@ filesystem::path exe(boost::process::v2::pid_type pid, boost::system::error_code
#elif (defined(__APPLE__) && defined(__MACH__)) && !TARGET_OS_IOS
filesystem::path exe(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path exe(boost::process::v2::pid_type pid, error_code & ec)
{
char buffer[PROC_PIDPATHINFO_MAXSIZE];
if (proc_pidpath(pid, buffer, sizeof(buffer)) > 0)
@@ -134,7 +134,7 @@ filesystem::path exe(boost::process::v2::pid_type pid, boost::system::error_code
#elif (defined(__linux__) || defined(__ANDROID__) || defined(__sun))
filesystem::path exe(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path exe(boost::process::v2::pid_type pid, error_code & ec)
{
#if (defined(__linux__) || defined(__ANDROID__))
return filesystem::canonical(
@@ -149,7 +149,7 @@ filesystem::path exe(boost::process::v2::pid_type pid, boost::system::error_code
#elif (defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__))
filesystem::path exe(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path exe(boost::process::v2::pid_type pid, error_code & ec)
{
#if (defined(__FreeBSD__) || defined(__DragonFly__))
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, pid};
@@ -174,14 +174,14 @@ filesystem::path exe(boost::process::v2::pid_type pid, boost::system::error_code
#elif defined(__OpenBSD__)
filesystem::path exe(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path exe(boost::process::v2::pid_type pid, error_code & ec)
{
BOOST_PROCESS_V2_ASSIGN_EC(ec, ENOTSUP, system_category());
return "";
}
#else
filesystem::path exe(boost::process::v2::pid_type pid, boost::system::error_code & ec)
filesystem::path exe(boost::process::v2::pid_type pid, error_code & ec)
{
BOOST_PROCESS_V2_ASSIGN_EC(ec, ENOTSUP, system_category());
return "";
@@ -190,7 +190,7 @@ filesystem::path exe(boost::process::v2::pid_type pid, boost::system::error_code
filesystem::path exe(boost::process::v2::pid_type pid)
{
boost::system::error_code ec;
error_code ec;
auto res = exe(pid, ec);
if (ec)
detail::throw_error(ec, "exe");

View File

@@ -27,7 +27,7 @@ namespace ext
#if defined(BOOST_PROCESS_V2_WINDOWS)
// type of process memory to read?
enum MEMTYP {MEMCMD, MEMCWD};
std::wstring cwd_cmd_from_proc(HANDLE proc, int type, boost::system::error_code & ec)
std::wstring cwd_cmd_from_proc(HANDLE proc, int type, error_code & ec)
{
std::wstring buffer;
PEB peb;
@@ -84,7 +84,7 @@ std::wstring cwd_cmd_from_proc(HANDLE proc, int type, boost::system::error_code
// with debug_privilege enabled allows reading info from more processes
// this includes stuff such as exe path, cwd path, cmdline, and environ
HANDLE open_process_with_debug_privilege(boost::process::v2::pid_type pid, boost::system::error_code & ec)
HANDLE open_process_with_debug_privilege(boost::process::v2::pid_type pid, error_code & ec)
{
HANDLE proc = nullptr;
HANDLE hToken = nullptr;

View File

@@ -70,7 +70,7 @@ pid_type current_pid() {return ::getpid();}
#if defined(BOOST_PROCESS_V2_WINDOWS)
std::vector<pid_type> all_pids(boost::system::error_code & ec)
std::vector<pid_type> all_pids(error_code & ec)
{
std::vector<pid_type> vec;
HANDLE hp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
@@ -92,7 +92,7 @@ std::vector<pid_type> all_pids(boost::system::error_code & ec)
return vec;
}
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
pid_type parent_pid(pid_type pid, error_code & ec)
{
pid_type ppid = static_cast<pid_type>(-1);
HANDLE hp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
@@ -119,7 +119,7 @@ pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
return ppid;
}
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
std::vector<pid_type> child_pids(pid_type pid, error_code & ec)
{
std::vector<pid_type> vec;
HANDLE hp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
@@ -147,7 +147,7 @@ std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
#elif (defined(__APPLE__) && defined(__MACH__)) && !TARGET_OS_IOS
std::vector<pid_type> all_pids(boost::system::error_code & ec)
std::vector<pid_type> all_pids(error_code & ec)
{
std::vector<pid_type> vec;
vec.resize(proc_listpids(PROC_ALL_PIDS, 0, nullptr, 0) / sizeof(pid_type));
@@ -161,7 +161,7 @@ std::vector<pid_type> all_pids(boost::system::error_code & ec)
return vec;
}
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
pid_type parent_pid(pid_type pid, error_code & ec)
{
pid_type ppid = static_cast<pid_type>(-1);
proc_bsdinfo proc_info;
@@ -175,7 +175,7 @@ pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
return ppid;
}
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
std::vector<pid_type> child_pids(pid_type pid, error_code & ec)
{
std::vector<pid_type> vec;
vec.resize(proc_listpids(PROC_PPID_ONLY, (uint32_t)pid, nullptr, 0) / sizeof(pid_type));
@@ -191,7 +191,7 @@ std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
#elif (defined(__linux__) || defined(__ANDROID__))
std::vector<pid_type> all_pids(boost::system::error_code & ec)
std::vector<pid_type> all_pids(error_code & ec)
{
std::vector<pid_type> vec;
DIR *proc = opendir("/proc");
@@ -211,7 +211,7 @@ std::vector<pid_type> all_pids(boost::system::error_code & ec)
return vec;
}
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
pid_type parent_pid(pid_type pid, error_code & ec)
{
pid_type ppid = static_cast<pid_type>(-1);
char buffer[BUFSIZ];
@@ -256,7 +256,7 @@ pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
return ppid;
}
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
std::vector<pid_type> child_pids(pid_type pid, error_code & ec)
{
std::vector<pid_type> vec;
std::vector<pid_type> pids = all_pids(ec);
@@ -275,7 +275,7 @@ std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
#elif defined(__FreeBSD__)
std::vector<pid_type> all_pids(boost::system::error_code & ec)
std::vector<pid_type> all_pids(error_code & ec)
{
std::vector<pid_type> vec;
int cntp = 0;
@@ -308,7 +308,7 @@ std::vector<pid_type> all_pids(boost::system::error_code & ec)
return vec;
}
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
pid_type parent_pid(pid_type pid, error_code & ec)
{
pid_type ppid = static_cast<pid_type>(-1);
int cntp = 0;
@@ -339,7 +339,7 @@ pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
return ppid;
}
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
std::vector<pid_type> child_pids(pid_type pid, error_code & ec)
{
std::vector<pid_type> vec;
int cntp = 0;
@@ -379,7 +379,7 @@ std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
#elif defined(__DragonFly__)
std::vector<pid_type> all_pids(boost::system::error_code & ec)
std::vector<pid_type> all_pids(error_code & ec)
{
std::vector<pid_type> vec;
int cntp = 0;
@@ -413,7 +413,7 @@ std::vector<pid_type> all_pids(boost::system::error_code & ec)
return vec;
}
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
pid_type parent_pid(pid_type pid, error_code & ec)
{
pid_type ppid = static_cast<pid_type>(-1);
int cntp = 0;
@@ -447,7 +447,7 @@ pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
return ppid;
}
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
std::vector<pid_type> child_pids(pid_type pid, error_code & ec)
{
std::vector<pid_type> vec;
int cntp = 0;
@@ -487,7 +487,7 @@ std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
#elif defined(__NetBSD__)
std::vector<pid_type> all_pids(boost::system::error_code & ec)
std::vector<pid_type> all_pids(error_code & ec)
{
std::vector<pid_type> vec;
int cntp = 0;
@@ -520,7 +520,7 @@ std::vector<pid_type> all_pids(boost::system::error_code & ec)
return vec;
}
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
pid_type parent_pid(pid_type pid, error_code & ec)
{
pid_type ppid = static_cast<pid_type>(-1);
int cntp = 0;
@@ -549,7 +549,7 @@ pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
return ppid;
}
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
std::vector<pid_type> child_pids(pid_type pid, error_code & ec)
{
std::vector<pid_type> vec;
int cntp = 0;
@@ -587,7 +587,7 @@ std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
#elif defined(__OpenBSD__)
std::vector<pid_type> all_pids(boost::system::error_code & ec)
std::vector<pid_type> all_pids(error_code & ec)
{
std::vector<pid_type> vec;
int cntp = 0;
@@ -623,7 +623,7 @@ std::vector<pid_type> all_pids(boost::system::error_code & ec)
return vec;
}
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
pid_type parent_pid(pid_type pid, error_code & ec)
{
pid_type ppid = static_cast<pid_type>(-1);
int cntp = 0;
@@ -652,7 +652,7 @@ pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
return ppid;
}
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
std::vector<pid_type> child_pids(pid_type pid, error_code & ec)
{
std::vector<pid_type> vec;
int cntp = 0;
@@ -691,7 +691,7 @@ std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
#elif defined(__sun)
std::vector<pid_type> all_pids(boost::system::error_code & ec)
std::vector<pid_type> all_pids(error_code & ec)
{
std::vector<pid_type> vec;
struct pid cur_pid;
@@ -726,7 +726,7 @@ std::vector<pid_type> all_pids(boost::system::error_code & ec)
return vec;
}
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
pid_type parent_pid(pid_type pid, error_code & ec)
{
pid_type ppid = static_cast<pid_type>(-1);
proc *proc_info = nullptr;
@@ -754,7 +754,7 @@ pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
return ppid;
}
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
std::vector<pid_type> child_pids(pid_type pid, error_code & ec)
{
std::vector<pid_type> vec;
struct pid cur_pid;
@@ -793,17 +793,17 @@ std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
}
#else
std::vector<pid_type> all_pids(boost::system::error_code & ec)
std::vector<pid_type> all_pids(error_code & ec)
{
BOOST_PROCESS_V2_ASSIGN_EC(ec, ENOTSUP, system_category());
return {};
}
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
pid_type parent_pid(pid_type pid, error_code & ec)
{
BOOST_PROCESS_V2_ASSIGN_EC(ec, ENOTSUP, system_category());
return pid;
}
std::vector<pid_type> child_pids(pid_type, boost::system::error_code & ec)
std::vector<pid_type> child_pids(pid_type, error_code & ec)
{
BOOST_PROCESS_V2_ASSIGN_EC(ec, ENOTSUP, system_category());
return {};
@@ -812,7 +812,7 @@ std::vector<pid_type> child_pids(pid_type, boost::system::error_code & ec)
std::vector<pid_type> all_pids()
{
boost::system::error_code ec;
error_code ec;
auto res = all_pids(ec);
if (ec)
detail::throw_error(ec, "all_pids");
@@ -821,7 +821,7 @@ std::vector<pid_type> all_pids()
pid_type parent_pid(pid_type pid)
{
boost::system::error_code ec;
error_code ec;
auto res = parent_pid(pid, ec);
if (ec)
detail::throw_error(ec, "parent_pid");
@@ -830,7 +830,7 @@ pid_type parent_pid(pid_type pid)
std::vector<pid_type> child_pids(pid_type pid)
{
boost::system::error_code ec;
error_code ec;
auto res = child_pids(pid, ec);
if (ec)
detail::throw_error(ec, "child_pids");

View File

@@ -63,7 +63,9 @@ BOOST_AUTO_TEST_CASE(environment)
for (auto && ke : bpe::current())
if (!std::get<1>(ke).empty())
{
BOOST_CHECK_EQUAL(bpe::get(std::get<0>(ke)), std::get<1>(ke));
}
#if defined(BOOST_PROCESS_V2_POSIX)