update boost
This commit is contained in:
24
linx64/include/boost/process/v2/impl/default_launcher.ipp
Normal file
24
linx64/include/boost/process/v2/impl/default_launcher.ipp
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// boost/process/v2/default_launcher.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2022 Klemens D. Morgenstern (klemens dot morgenstern at gmx dot net)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BOOST_PROCESS_V2_IMPL_DEFAULT_LAUNCHER_IPP
|
||||
#define BOOST_PROCESS_V2_IMPL_DEFAULT_LAUNCHER_IPP
|
||||
|
||||
#include <boost/process/v2/detail/config.hpp>
|
||||
|
||||
#if defined(BOOST_PROCESS_V2_WINDOWS)
|
||||
#include <boost/process/v2/windows/impl/default_launcher.ipp>
|
||||
#else
|
||||
#include <boost/process/v2/posix/detail/close_handles.ipp>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif //BOOST_PROCESS_V2_IMPL_DEFAULT_LAUNCHER_IPP
|
||||
47
linx64/include/boost/process/v2/impl/environment.ipp
Normal file
47
linx64/include/boost/process/v2/impl/environment.ipp
Normal file
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// boost/process/v2/impl/environment.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2022 Klemens D. Morgenstern (klemens dot morgenstern at gmx dot net)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BOOST_PROCESS_V2_IMPL_ENVIRONMENT_IPP
|
||||
#define BOOST_PROCESS_V2_IMPL_ENVIRONMENT_IPP
|
||||
|
||||
#include <boost/process/v2/detail/config.hpp>
|
||||
#include <boost/process/v2/default_launcher.hpp>
|
||||
#include <boost/process/v2/environment.hpp>
|
||||
|
||||
BOOST_PROCESS_V2_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(BOOST_PROCESS_V2_WINDOWS)
|
||||
|
||||
error_code process_environment::on_setup(windows::default_launcher & launcher, const filesystem::path &, const std::wstring &)
|
||||
{
|
||||
if (!unicode_env.empty() && !ec)
|
||||
{
|
||||
launcher.creation_flags |= CREATE_UNICODE_ENVIRONMENT ;
|
||||
launcher.environment = unicode_env.data();
|
||||
}
|
||||
|
||||
return ec;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
error_code process_environment::on_setup(posix::default_launcher & launcher, const filesystem::path &, const char * const *)
|
||||
{
|
||||
launcher.env = env.data();
|
||||
return error_code{};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
BOOST_PROCESS_V2_END_NAMESPACE
|
||||
|
||||
|
||||
#endif //BOOST_PROCESS_V2_IMPL_ENVIRONMENT_IPP
|
||||
206
linx64/include/boost/process/v2/impl/error.ipp
Normal file
206
linx64/include/boost/process/v2/impl/error.ipp
Normal file
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) 2021 Klemens D. Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PROCESS_V2_IMPL_ERROR_IPP
|
||||
#define BOOST_PROCESS_V2_IMPL_ERROR_IPP
|
||||
|
||||
#include <boost/process/v2/detail/config.hpp>
|
||||
#include <boost/process/v2/error.hpp>
|
||||
#include <boost/process/v2/exit_code.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#if defined(BOOST_PROCESS_V2_POSIX)
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
BOOST_PROCESS_V2_BEGIN_NAMESPACE
|
||||
|
||||
namespace error
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
struct utf8_category final : public error_category
|
||||
{
|
||||
utf8_category() : error_category(0xDAEDu) {}
|
||||
|
||||
const char* name() const noexcept
|
||||
{
|
||||
return "process.v2.utf8";
|
||||
}
|
||||
std::string message(int value) const
|
||||
{
|
||||
switch (static_cast<utf8_conv_error>(value))
|
||||
{
|
||||
case utf8_conv_error::insufficient_buffer:
|
||||
return "A supplied buffer size was not large enough";
|
||||
case utf8_conv_error::invalid_character:
|
||||
return "Invalid characters were found in a string.";
|
||||
default:
|
||||
return "process.v2.utf8 error";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct exit_code_category final : public error_category
|
||||
{
|
||||
exit_code_category() : error_category(0xDAEEu) {}
|
||||
|
||||
const char* name() const noexcept
|
||||
{
|
||||
return "process.v2.exit_code";
|
||||
}
|
||||
std::string message(int status) const
|
||||
{
|
||||
switch (evaluate_exit_code(status))
|
||||
{
|
||||
case v2::detail::still_active:
|
||||
return "still-active";
|
||||
case EXIT_SUCCESS:
|
||||
return "exit_success";
|
||||
case EXIT_FAILURE:
|
||||
return "exit_failure";
|
||||
default:
|
||||
#if defined(BOOST_PROCESS_V2_POSIX)
|
||||
if (WIFCONTINUED(status))
|
||||
return "continued";
|
||||
switch (WTERMSIG(status))
|
||||
{
|
||||
# if defined(SIGABRT)
|
||||
case SIGABRT: return "SIGABRT: Abort signal from abort(3)";
|
||||
# endif
|
||||
# if defined(SIGALRM)
|
||||
case SIGALRM: return "SIGALRM: Timer signal from alarm(2)";
|
||||
# endif
|
||||
# if defined(SIGBUS)
|
||||
case SIGBUS: return "SIGBUS: Bus error (bad memory access)";
|
||||
# endif
|
||||
# if defined(SIGCHLD)
|
||||
case SIGCHLD: return "SIGCHLD: Child stopped or terminated";
|
||||
# endif
|
||||
# if defined(SIGCONT)
|
||||
case SIGCONT: return "SIGCONT: Continue if stopped";
|
||||
# endif
|
||||
# if defined(SIGEMT)
|
||||
case SIGEMT: return "SIGEMT: Emulator trap";
|
||||
# endif
|
||||
# if defined(SIGFPE)
|
||||
case SIGFPE: return "SIGFPE: Floating-point exception";
|
||||
# endif
|
||||
# if defined(SIGHUP)
|
||||
case SIGHUP: return "SIGHUP: Hangup detected on controlling terminal";
|
||||
# endif
|
||||
# if defined(SIGILL)
|
||||
case SIGILL: return "SIGILL: Illegal Instruction";
|
||||
# endif
|
||||
# if defined(SIGINFO)
|
||||
case SIGINFO: return "SIGINFO: A synonym for SIGPWR";
|
||||
# endif
|
||||
# if defined(SIGINT)
|
||||
case SIGINT: return "SIGINT: Interrupt from keyboard";
|
||||
# endif
|
||||
# if defined(SIGIO)
|
||||
case SIGIO: return "SIGIO: I/O now possible (4.2BSD)";
|
||||
# endif
|
||||
# if defined(SIGKILL)
|
||||
case SIGKILL: return "SIGKILL: Kill signal";
|
||||
# endif
|
||||
# if defined(SIGLOST)
|
||||
case SIGLOST: return "SIGLOST: File lock lost (unused)";
|
||||
# endif
|
||||
# if defined(SIGPIPE)
|
||||
case SIGPIPE: return "SIGPIPE: Broken pipe: write to pipe with no";
|
||||
# endif
|
||||
# if defined(SIGPOLL) && !defined(SIGIO)
|
||||
case SIGPOLL: return "SIGPOLL: Pollable event (Sys V);";
|
||||
# endif
|
||||
# if defined(SIGPROF)
|
||||
case SIGPROF: return "SIGPROF: Profiling timer expired";
|
||||
# endif
|
||||
# if defined(SIGPWR)
|
||||
case SIGPWR: return "SIGPWR: Power failure (System V)";
|
||||
# endif
|
||||
# if defined(SIGQUIT)
|
||||
case SIGQUIT: return "SIGQUIT: Quit from keyboard";
|
||||
# endif
|
||||
# if defined(SIGSEGV)
|
||||
case SIGSEGV: return "SIGSEGV: Invalid memory reference";
|
||||
# endif
|
||||
# if defined(SIGSTKFLT)
|
||||
case SIGSTKFLT: return "SIGSTKFLT: Stack fault on coprocessor (unused)";
|
||||
# endif
|
||||
# if defined(SIGSTOP)
|
||||
case SIGSTOP: return "SIGSTOP: Stop process";
|
||||
# endif
|
||||
# if defined(SIGTSTP)
|
||||
case SIGTSTP: return "SIGTSTP: Stop typed at terminal";
|
||||
# endif
|
||||
# if defined(SIGSYS)
|
||||
case SIGSYS: return "SIGSYS: Bad system call (SVr4);";
|
||||
# endif
|
||||
# if defined(SIGTERM)
|
||||
case SIGTERM: return "SIGTERM: Termination signal";
|
||||
# endif
|
||||
# if defined(SIGTRAP)
|
||||
case SIGTRAP: return "SIGTRAP: Trace/breakpoint trap";
|
||||
# endif
|
||||
# if defined(SIGTTIN)
|
||||
case SIGTTIN: return "SIGTTIN: Terminal input for background process";
|
||||
# endif
|
||||
# if defined(SIGTTOU)
|
||||
case SIGTTOU: return "SIGTTOU: Terminal output for background process";
|
||||
# endif
|
||||
# if defined(SIGURG)
|
||||
case SIGURG: return "SIGURG: Urgent condition on socket (4.2BSD)";
|
||||
# endif
|
||||
# if defined(SIGUSR1)
|
||||
case SIGUSR1: return "SIGUSR1: User-defined signal 1";
|
||||
# endif
|
||||
# if defined(SIGUSR2)
|
||||
case SIGUSR2: return "SIGUSR2: User-defined signal 2";
|
||||
# endif
|
||||
# if defined(SIGVTALRM)
|
||||
case SIGVTALRM: return "SIGVTALRM: Virtual alarm clock (4.2BSD)";
|
||||
# endif
|
||||
# if defined(SIGXCPU)
|
||||
case SIGXCPU: return "SIGXCPU: CPU time limit exceeded (4.2BSD);";
|
||||
# endif
|
||||
# if defined(SIGXFSZ)
|
||||
case SIGXFSZ: return "SIGXFSZ: File size limit exceeded (4.2BSD);";
|
||||
# endif
|
||||
# if defined(SIGWINCH)
|
||||
case SIGWINCH: return "SIGWINCH: Window resize signal (4.3BSD, Sun)";
|
||||
# endif
|
||||
default: return "Unknown signal";
|
||||
}
|
||||
#endif
|
||||
return "exited with other error";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace detail
|
||||
|
||||
BOOST_PROCESS_V2_DECL const error_category& get_utf8_category()
|
||||
{
|
||||
static detail::utf8_category instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
BOOST_PROCESS_V2_DECL const error_category& get_exit_code_category()
|
||||
{
|
||||
static detail::exit_code_category instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_PROCESS_V2_END_NAMESPACE
|
||||
|
||||
#endif //BOOST_PROCESS_V2_IMPL_ERROR_IPP
|
||||
762
linx64/include/boost/process/v2/impl/pid.ipp
Normal file
762
linx64/include/boost/process/v2/impl/pid.ipp
Normal file
@@ -0,0 +1,762 @@
|
||||
// Copyright (c) 2022 Klemens D. Morgenstern
|
||||
// Copyright (c) 2022 Samuel Venable
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PROCESS_V2_IMPL_PID_IPP
|
||||
#define BOOST_PROCESS_V2_IMPL_PID_IPP
|
||||
|
||||
#include <boost/process/v2/detail/config.hpp>
|
||||
#include <boost/process/v2/detail/last_error.hpp>
|
||||
#include <boost/process/v2/detail/throw_error.hpp>
|
||||
#include <boost/process/v2/pid.hpp>
|
||||
|
||||
#if defined(BOOST_PROCESS_V2_WINDOWS)
|
||||
#include <windows.h>
|
||||
#include <tlhelp32.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if (defined(__APPLE__) && defined(__MACH__))
|
||||
#include <sys/proc_info.h>
|
||||
#include <libproc.h>
|
||||
#endif
|
||||
|
||||
#if (defined(__linux__) || defined(__ANDROID__))
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/user.h>
|
||||
#include <libutil.h>
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
#if (defined(__DragonFly__) || defined(__OpenBSD__))
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/user.h>
|
||||
#include <kvm.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#include <sys/types.h>
|
||||
#include <kvm.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#if defined(__sun)
|
||||
#include <sys/types.h>
|
||||
#include <kvm.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/proc.h>
|
||||
#endif
|
||||
|
||||
BOOST_PROCESS_V2_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(BOOST_PROCESS_V2_WINDOWS)
|
||||
pid_type current_pid() {return ::GetCurrentProcessId();}
|
||||
#else
|
||||
pid_type current_pid() {return ::getpid();}
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_PROCESS_V2_WINDOWS)
|
||||
|
||||
std::vector<pid_type> all_pids(boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
HANDLE hp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
if (!hp)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
PROCESSENTRY32 pe;
|
||||
pe.dwSize = sizeof(PROCESSENTRY32);
|
||||
if (Process32First(hp, &pe))
|
||||
{
|
||||
do
|
||||
{
|
||||
vec.push_back(pe.th32ProcessID);
|
||||
} while (Process32Next(hp, &pe));
|
||||
}
|
||||
CloseHandle(hp);
|
||||
return vec;
|
||||
}
|
||||
|
||||
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
pid_type ppid = static_cast<pid_type>(-1);
|
||||
HANDLE hp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
if (!hp)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
PROCESSENTRY32 pe;
|
||||
pe.dwSize = sizeof(PROCESSENTRY32);
|
||||
if (Process32First(hp, &pe))
|
||||
{
|
||||
do
|
||||
{
|
||||
if (pe.th32ProcessID == pid)
|
||||
{
|
||||
ppid = pe.th32ParentProcessID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (Process32Next(hp, &pe));
|
||||
}
|
||||
CloseHandle(hp);
|
||||
return ppid;
|
||||
}
|
||||
|
||||
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
HANDLE hp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
if (!hp)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
PROCESSENTRY32 pe;
|
||||
pe.dwSize = sizeof(PROCESSENTRY32);
|
||||
if (Process32First(hp, &pe))
|
||||
{
|
||||
do
|
||||
{
|
||||
if (pe.th32ParentProcessID == pid)
|
||||
{
|
||||
vec.push_back(pe.th32ProcessID);
|
||||
}
|
||||
}
|
||||
while (Process32Next(hp, &pe));
|
||||
}
|
||||
CloseHandle(hp);
|
||||
return vec;
|
||||
}
|
||||
|
||||
#elif (defined(__APPLE__) && defined(__MACH__))
|
||||
|
||||
std::vector<pid_type> all_pids(boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
vec.resize(proc_listpids(PROC_ALL_PIDS, 0, nullptr, 0) / sizeof(pid_type));
|
||||
const auto sz = proc_listpids(PROC_ALL_PIDS, 0, &vec[0], sizeof(pid_type) * vec.size());
|
||||
if (sz < 0)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return {};
|
||||
}
|
||||
vec.resize(sz);
|
||||
return vec;
|
||||
}
|
||||
|
||||
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
pid_type ppid = static_cast<pid_type>(-1);
|
||||
proc_bsdinfo proc_info;
|
||||
if (proc_pidinfo(pid, PROC_PIDTBSDINFO, 0, &proc_info, sizeof(proc_info)) <= 0)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
else
|
||||
ppid = proc_info.pbi_ppid;
|
||||
return ppid;
|
||||
}
|
||||
|
||||
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
vec.resize(proc_listpids(PROC_PPID_ONLY, (uint32_t)pid, nullptr, 0) / sizeof(pid_type));
|
||||
const auto sz = proc_listpids(PROC_PPID_ONLY, (uint32_t)pid, &vec[0], sizeof(pid_type) * vec.size());
|
||||
if (sz < 0)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return {};
|
||||
}
|
||||
vec.resize(sz);
|
||||
return vec;
|
||||
}
|
||||
|
||||
#elif (defined(__linux__) || defined(__ANDROID__))
|
||||
|
||||
std::vector<pid_type> all_pids(boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
DIR *proc = opendir("/proc");
|
||||
if (!proc)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
struct dirent *ent = nullptr;
|
||||
while ((ent = readdir(proc)))
|
||||
{
|
||||
if (!isdigit(*ent->d_name))
|
||||
continue;
|
||||
vec.push_back(atoi(ent->d_name));
|
||||
}
|
||||
closedir(proc);
|
||||
return vec;
|
||||
}
|
||||
|
||||
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
pid_type ppid = static_cast<pid_type>(-1);
|
||||
char buffer[BUFSIZ];
|
||||
sprintf(buffer, "/proc/%d/stat", pid);
|
||||
FILE *stat = fopen(buffer, "r");
|
||||
if (!stat)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::size_t size = fread(buffer, sizeof(char), sizeof(buffer), stat);
|
||||
if (size > 0)
|
||||
{
|
||||
char *token = nullptr;
|
||||
if ((token = strtok(buffer, " ")))
|
||||
{
|
||||
if ((token = strtok(nullptr, " ")))
|
||||
{
|
||||
if ((token = strtok(nullptr, " ")))
|
||||
{
|
||||
if ((token = strtok(nullptr, " ")))
|
||||
{
|
||||
ppid = (pid_type)strtoul(token, nullptr, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!token)
|
||||
{
|
||||
fclose(stat);
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
}
|
||||
fclose(stat);
|
||||
}
|
||||
return ppid;
|
||||
}
|
||||
|
||||
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
std::vector<pid_type> pids = all_pids(ec);
|
||||
if (!pids.empty())
|
||||
vec.reserve(pids.size());
|
||||
for (std::size_t i = 0; i < pids.size(); i++)
|
||||
{
|
||||
pid_type ppid = parent_pid(pids[i], ec);
|
||||
if (ppid != -1 && ppid == pid)
|
||||
{
|
||||
vec.push_back(pids[i]);
|
||||
}
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
|
||||
std::vector<pid_type> all_pids(boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
int cntp = 0;
|
||||
kinfo_proc *proc_info = kinfo_getallproc(&cntp);
|
||||
if (proc_info)
|
||||
{
|
||||
vec.reserve(cntp);
|
||||
for (int i = 0; i < cntp; i++)
|
||||
vec.push_back(proc_info[i].ki_pid);
|
||||
free(proc_info);
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
|
||||
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
pid_type ppid = static_cast<pid_type>(-1);
|
||||
kinfo_proc *proc_info = kinfo_getproc(pid);
|
||||
if (proc_info)
|
||||
{
|
||||
ppid = proc_info->ki_ppid;
|
||||
free(proc_info);
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
|
||||
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
int cntp = 0;
|
||||
kinfo_proc *proc_info = kinfo_getallproc(&cntp);
|
||||
if (proc_info)
|
||||
{
|
||||
vec.reserve(cntp);
|
||||
for (int i = 0; i < cntp; i++)
|
||||
{
|
||||
if (proc_info[i].ki_ppid == pid)
|
||||
{
|
||||
vec.push_back(proc_info[i].ki_pid);
|
||||
}
|
||||
}
|
||||
free(proc_info);
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
|
||||
#elif defined(__DragonFly__)
|
||||
|
||||
std::vector<pid_type> all_pids(boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
int cntp = 0;
|
||||
kinfo_proc *proc_info = nullptr;
|
||||
const char *nlistf, *memf;
|
||||
nlistf = memf = "/dev/null";
|
||||
struct closer
|
||||
{
|
||||
void operator()(kvm_t * kd)
|
||||
{
|
||||
kvm_close(kd);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_openfiles(nlistf, memf, nullptr, O_RDONLY, nullptr)};
|
||||
if (!kd)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
if ((proc_info = kvm_getprocs(kd.get(), KERN_PROC_ALL, 0, &cntp)))
|
||||
{
|
||||
vec.reserve(cntp);
|
||||
for (int i = 0; i < cntp; i++)
|
||||
if (proc_info[i].kp_pid >= 0)
|
||||
vec.push_back(proc_info[i].kp_pid);
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
|
||||
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
pid_type ppid = static_cast<pid_type>(-1);
|
||||
int cntp = 0;
|
||||
kinfo_proc *proc_info = nullptr;
|
||||
const char *nlistf, *memf;
|
||||
nlistf = memf = "/dev/null";
|
||||
struct closer
|
||||
{
|
||||
void operator()(kvm_t * kd)
|
||||
{
|
||||
kvm_close(kd);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_openfiles(nlistf, memf, nullptr, O_RDONLY, nullptr)};
|
||||
if (!kd)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
if ((proc_info = kvm_getprocs(kd.get(), KERN_PROC_PID, pid, &cntp)))
|
||||
{
|
||||
if (proc_info->kp_ppid >= 0)
|
||||
{
|
||||
ppid = proc_info->kp_ppid;
|
||||
}
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
|
||||
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
int cntp = 0;
|
||||
kinfo_proc *proc_info = nullptr;
|
||||
const char *nlistf, *memf;
|
||||
nlistf = memf = "/dev/null";
|
||||
struct closer
|
||||
{
|
||||
void operator()(kvm_t * kd)
|
||||
{
|
||||
kvm_close(kd);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_openfiles(nlistf, memf, nullptr, O_RDONLY, nullptr)};
|
||||
if (!kd)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
if ((proc_info = kvm_getprocs(kd.get(), KERN_PROC_ALL, 0, &cntp)))
|
||||
{
|
||||
vec.reserve(cntp);
|
||||
for (int i = 0; i < cntp; i++)
|
||||
{
|
||||
if (proc_info[i].kp_pid >= 0 && proc_info[i].kp_ppid >= 0 && proc_info[i].kp_ppid == pid)
|
||||
{
|
||||
vec.push_back(proc_info[i].kp_pid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
|
||||
#elif defined(__NetBSD__)
|
||||
|
||||
std::vector<pid_type> all_pids(boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
int cntp = 0;
|
||||
kinfo_proc2 *proc_info = nullptr;
|
||||
struct closer
|
||||
{
|
||||
void operator()(kvm_t * kd)
|
||||
{
|
||||
kvm_close(kd);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_openfiles(nullptr, nullptr, nullptr, KVM_NO_FILES, nullptr)};
|
||||
if (!kd)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
if ((proc_info = kvm_getproc2(kd.get(), KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), &cntp)))
|
||||
{
|
||||
vec.reserve(cntp);
|
||||
for (int i = cntp - 1; i >= 0; i--)
|
||||
{
|
||||
vec.push_back(proc_info[i].p_pid);
|
||||
}
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
|
||||
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
pid_type ppid = static_cast<pid_type>(-1);
|
||||
int cntp = 0;
|
||||
kinfo_proc2 *proc_info = nullptr;
|
||||
struct closer
|
||||
{
|
||||
void operator()(kvm_t * kd)
|
||||
{
|
||||
kvm_close(kd);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_openfiles(nullptr, nullptr, nullptr, KVM_NO_FILES, nullptr)};
|
||||
if (!kd)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
if ((proc_info = kvm_getproc2(kd.get(), KERN_PROC_PID, pid, sizeof(struct kinfo_proc2), &cntp)))
|
||||
{
|
||||
ppid = proc_info->p_ppid;
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
|
||||
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
int cntp = 0;
|
||||
kinfo_proc2 *proc_info = nullptr;
|
||||
struct closer
|
||||
{
|
||||
void operator()(kvm_t * kd)
|
||||
{
|
||||
kvm_close(kd);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_openfiles(nullptr, nullptr, nullptr, KVM_NO_FILES, nullptr)};
|
||||
if (!kd)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
if ((proc_info = kvm_getproc2(kd.get(), KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), &cntp)))
|
||||
{
|
||||
vec.reserve(cntp);
|
||||
for (int i = cntp - 1; i >= 0; i--)
|
||||
{
|
||||
if (proc_info[i].p_ppid == pid)
|
||||
{
|
||||
vec.push_back(proc_info[i].p_pid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
|
||||
#elif defined(__OpenBSD__)
|
||||
|
||||
std::vector<pid_type> all_pids(boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
int cntp = 0;
|
||||
kinfo_proc *proc_info = nullptr;
|
||||
struct closer
|
||||
{
|
||||
void operator()(kvm_t * kd)
|
||||
{
|
||||
kvm_close(kd);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_openfiles(nullptr, nullptr, nullptr, KVM_NO_FILES, nullptr)};
|
||||
if (!kd)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
if ((proc_info = kvm_getprocs(kd.get(), KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &cntp)))
|
||||
{
|
||||
vec.reserve(cntp);
|
||||
for (int i = cntp - 1; i >= 0; i--)
|
||||
{
|
||||
if (proc_info[i].kp_pid >= 0)
|
||||
{
|
||||
vec.push_back(proc_info[i].kp_pid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
|
||||
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
pid_type ppid = static_cast<pid_type>(-1);
|
||||
int cntp = 0;
|
||||
kinfo_proc *proc_info = nullptr;
|
||||
struct closer
|
||||
{
|
||||
void operator()(kvm_t * kd)
|
||||
{
|
||||
kvm_close(kd);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_openfiles(nullptr, nullptr, nullptr, KVM_NO_FILES, nullptr)};
|
||||
if (!kd)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
if ((proc_info = kvm_getprocs(kd.get(), KERN_PROC_PID, pid, sizeof(struct kinfo_proc), &cntp)))
|
||||
{
|
||||
ppid = proc_info->p_ppid;
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
|
||||
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
int cntp = 0;
|
||||
kinfo_proc *proc_info = nullptr;
|
||||
struct closer
|
||||
{
|
||||
void operator()(kvm_t * kd)
|
||||
{
|
||||
kvm_close(kd);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_openfiles(nullptr, nullptr, nullptr, KVM_NO_FILES, nullptr)};
|
||||
if (!kd)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
if ((proc_info = kvm_getprocs(kd.get(), KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &cntp)))
|
||||
{
|
||||
vec.reserve(cntp);
|
||||
for (int i = cntp - 1; i >= 0; i--)
|
||||
{
|
||||
if (proc_info[i].p_ppid == pid)
|
||||
{
|
||||
vec.push_back(proc_info[i].p_pid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
||||
#elif defined(__sun)
|
||||
|
||||
std::vector<pid_type> all_pids(boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
struct pid cur_pid;
|
||||
proc *proc_info = nullptr;
|
||||
struct closer
|
||||
{
|
||||
void operator()(kvm_t * kd)
|
||||
{
|
||||
kvm_close(kd);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_open(nullptr, nullptr, nullptr, O_RDONLY, nullptr)};
|
||||
if (!kd)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
while ((proc_info = kvm_nextproc(kd)))
|
||||
{
|
||||
if (kvm_kread(kd, (std::uintptr_t)proc_info->p_pidp, &cur_pid, sizeof(cur_pid)) != -1)
|
||||
{
|
||||
vec.insert(vec.begin(), cur_pid.pid_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
||||
pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
pid_type ppid = static_cast<pid_type>(-1);
|
||||
proc *proc_info = nullptr;
|
||||
struct closer
|
||||
{
|
||||
void operator()(kvm_t * kd)
|
||||
{
|
||||
kvm_close(kd);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_open(nullptr, nullptr, nullptr, O_RDONLY, nullptr)};
|
||||
if (!kd)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
if ((proc_info = kvm_getproc(kd, pid)))
|
||||
{
|
||||
ppid = proc_info->p_ppid;
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return ppid;
|
||||
}
|
||||
|
||||
std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
|
||||
{
|
||||
std::vector<pid_type> vec;
|
||||
struct pid cur_pid;
|
||||
proc *proc_info = nullptr;
|
||||
struct closer
|
||||
{
|
||||
void operator()(kvm_t * kd)
|
||||
{
|
||||
kvm_close(kd);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_open(nullptr, nullptr, nullptr, O_RDONLY, nullptr);
|
||||
if (!kd)
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
return vec;
|
||||
}
|
||||
while ((proc_info = kvm_nextproc(kd)))
|
||||
{
|
||||
if (proc_info->p_ppid == pid)
|
||||
{
|
||||
if (kvm_kread(kd, (std::uintptr_t)proc_info->p_pidp, &cur_pid, sizeof(cur_pid)) != -1)
|
||||
{
|
||||
vec.insert(vec.begin(), cur_pid.pid_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
||||
#else
|
||||
#error "Platform not supported"
|
||||
#endif
|
||||
|
||||
std::vector<pid_type> all_pids()
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
auto res = all_pids(ec);
|
||||
if (ec)
|
||||
detail::throw_error(ec, "all_pids");
|
||||
return res;
|
||||
}
|
||||
|
||||
pid_type parent_pid(pid_type pid)
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
auto res = parent_pid(pid, ec);
|
||||
if (ec)
|
||||
detail::throw_error(ec, "parent_pid");
|
||||
return res;
|
||||
}
|
||||
|
||||
std::vector<pid_type> child_pids(pid_type pid)
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
auto res = child_pids(pid, ec);
|
||||
if (ec)
|
||||
detail::throw_error(ec, "child_pids");
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOST_PROCESS_V2_END_NAMESPACE
|
||||
|
||||
#endif // BOOST_PROCESS_V2_IMPL_PID_IPP
|
||||
|
||||
17
linx64/include/boost/process/v2/impl/process_handle.ipp
Normal file
17
linx64/include/boost/process/v2/impl/process_handle.ipp
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) 2022 Klemens D. Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PROCESS_V2_IMPL_PROCESS_HANDLE_IPP
|
||||
#define BOOST_PROCESS_V2_IMPL_PROCESS_HANDLE_IPP
|
||||
|
||||
#include <boost/process/v2/detail/config.hpp>
|
||||
|
||||
#if defined(BOOST_PROCESS_V2_WINDOWS)
|
||||
#include <boost/process/v2/detail/impl/process_handle_windows.ipp>
|
||||
#else
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif //BOOST_PROCESS_V2_IMPL_PROCESS_HANDLE_IPP
|
||||
137
linx64/include/boost/process/v2/impl/shell.ipp
Normal file
137
linx64/include/boost/process/v2/impl/shell.ipp
Normal file
@@ -0,0 +1,137 @@
|
||||
// Copyright (c) 2022 Klemens D. Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PROCESS_V2_IMPL_SHELL_IPP
|
||||
#define BOOST_PROCESS_V2_IMPL_SHELL_IPP
|
||||
|
||||
#include <boost/process/v2/detail/config.hpp>
|
||||
#include <boost/process/v2/detail/last_error.hpp>
|
||||
#include <boost/process/v2/detail/throw_error.hpp>
|
||||
#include <boost/process/v2/detail/config.hpp>
|
||||
#include <boost/process/v2/error.hpp>
|
||||
#include <boost/process/v2/shell.hpp>
|
||||
|
||||
#if defined(BOOST_PROCESS_V2_WINDOWS)
|
||||
#include <shellapi.h>
|
||||
#else
|
||||
#include <wordexp.h>
|
||||
#endif
|
||||
|
||||
BOOST_PROCESS_V2_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(BOOST_PROCESS_V2_WINDOWS)
|
||||
BOOST_PROCESS_V2_DECL const error_category& get_shell_category()
|
||||
{
|
||||
return system_category();
|
||||
}
|
||||
#else
|
||||
|
||||
struct shell_category_t final : public error_category
|
||||
{
|
||||
shell_category_t() : error_category(0xDAF1u) {}
|
||||
|
||||
const char* name() const noexcept
|
||||
{
|
||||
return "process.v2.utf8";
|
||||
}
|
||||
std::string message(int value) const
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case WRDE_BADCHAR:
|
||||
return "Illegal occurrence of newline or one of |, &, ;, <, >, (, ), {, }.";
|
||||
case WRDE_BADVAL:
|
||||
return "An undefined shell variable was referenced, and the WRDE_UNDEF flag told us to consider this an error.";
|
||||
case WRDE_CMDSUB:
|
||||
return "Command substitution occurred, and the WRDE_NOCMD flag told us to consider this an error.";
|
||||
case WRDE_NOSPACE:
|
||||
return "Out of memory.";
|
||||
case WRDE_SYNTAX:
|
||||
return "Shell syntax error, such as unbalanced parentheses or unmatched quotes.";
|
||||
default:
|
||||
return "process.v2.wordexp error";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_PROCESS_V2_DECL const error_category& get_shell_category()
|
||||
{
|
||||
static shell_category_t instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (BOOST_PROCESS_V2_WINDOWS)
|
||||
|
||||
void shell::parse_()
|
||||
{
|
||||
argv_ = ::CommandLineToArgvW(input_.c_str(), &argc_);
|
||||
if (argv_ == nullptr)
|
||||
{
|
||||
error_code ec;
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec);
|
||||
throw system_error(ec, "shell::parse");
|
||||
}
|
||||
}
|
||||
|
||||
shell::~shell()
|
||||
{
|
||||
if (argv_ != nullptr)
|
||||
LocalFree(argv_);
|
||||
}
|
||||
|
||||
auto shell::args() const-> args_type
|
||||
{
|
||||
return input_.c_str();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void shell::parse_()
|
||||
{
|
||||
wordexp_t we{};
|
||||
auto cd = wordexp(input_.c_str(), &we, WRDE_NOCMD);
|
||||
|
||||
if (cd != 0)
|
||||
detail::throw_error(error_code(cd, get_shell_category()), "shell::parse");
|
||||
else
|
||||
{
|
||||
argc_ = static_cast<int>(we.we_wordc);
|
||||
argv_ = we.we_wordv;
|
||||
}
|
||||
|
||||
free_argv_ = +[](int argc, char ** argv)
|
||||
{
|
||||
wordexp_t we{
|
||||
.we_wordc = static_cast<std::size_t>(argc),
|
||||
.we_wordv = argv,
|
||||
.we_offs = 0
|
||||
};
|
||||
wordfree(&we);
|
||||
};
|
||||
}
|
||||
|
||||
shell::~shell()
|
||||
{
|
||||
if (argv_ != nullptr && free_argv_ != nullptr)
|
||||
free_argv_(argc_, argv_);
|
||||
}
|
||||
|
||||
auto shell::args() const -> args_type
|
||||
{
|
||||
if (argc() == 0)
|
||||
{
|
||||
static const char * helper = nullptr;
|
||||
return &helper;
|
||||
}
|
||||
else
|
||||
return const_cast<const char**>(argv());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
BOOST_PROCESS_V2_END_NAMESPACE
|
||||
|
||||
#endif //BOOST_PROCESS_V2_IMPL_SHELL_IPP
|
||||
Reference in New Issue
Block a user