mirror of
https://github.com/boostorg/process.git
synced 2026-01-20 04:42:24 +00:00
Compare commits
1 Commits
boost-1.87
...
freebsd2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5506b8e533 |
@@ -14,8 +14,8 @@ windowsglobalimage="cppalliance/dronevs2019"
|
||||
|
||||
def main(ctx):
|
||||
return [
|
||||
freebsd_cxx("gcc 11 freebsd", "g++-11", buildtype="boost", buildscript="drone", freebsd_version="13.1", environment={'B2_TOOLSET': 'gcc-11', 'B2_CXXSTD': '17,20', 'B2_LINKFLAGS': '-Wl,-rpath=/usr/local/lib/gcc11'}, globalenv=globalenv),
|
||||
freebsd_cxx("clang 14 freebsd", "clang++-14", buildtype="boost", buildscript="drone", freebsd_version="13.1", environment={'B2_TOOLSET': 'clang-14', 'B2_CXXSTD': '17,20'}, globalenv=globalenv),
|
||||
freebsd_cxx("gcc freebsd", "g++", buildtype="boost", buildscript="drone", freebsd_version="13.1", environment={'B2_TOOLSET': 'gcc', 'B2_CXXSTD': '11'}, globalenv=globalenv),
|
||||
freebsd_cxx("clang 14 freebsd", "clang++-14", buildtype="boost", buildscript="drone", freebsd_version="13.1", environment={'B2_TOOLSET': 'clang-14', 'B2_CXXSTD': '11'}, globalenv=globalenv),
|
||||
linux_cxx("docs", "", packages="docbook docbook-xml docbook-xsl xsltproc libsaxonhe-java default-jre-headless flex libfl-dev bison unzip rsync", image="cppalliance/droneubuntu1804:1", buildtype="docs", buildscript="drone", environment={"COMMENT": "docs"}, globalenv=globalenv),
|
||||
linux_cxx("asan", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'asan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '11', 'B2_ASAN': '1', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1', 'DRONE_EXTRA_PRIVILEGED': 'True', 'DRONE_JOB_UUID': '356a192b79'}, globalenv=globalenv, privileged=True),
|
||||
linux_cxx("ubsan", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'ubsan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '11', 'B2_UBSAN': '1', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1', 'B2_LINKFLAGS': '-fuse-ld=gold', 'DRONE_JOB_UUID': '77de68daec'}, globalenv=globalenv),
|
||||
|
||||
@@ -140,7 +140,10 @@ struct limit_handles_ : handler_base_ext
|
||||
auto itr = std::find(all_handles.begin(), all_handles .end(), handle);
|
||||
::boost::winapi::DWORD_ flags = 0u;
|
||||
if (itr != all_handles.end())
|
||||
*itr = ::boost::winapi::INVALID_HANDLE_VALUE_; // the handle is used mark it as invalid, so it doesn't get reset
|
||||
*itr = ::boost::winapi::INVALID_HANDLE_VALUE_;
|
||||
else if ((::boost::winapi::GetHandleInformation(*itr, &flags) != 0)
|
||||
&&((flags & ::boost::winapi::HANDLE_FLAG_INHERIT_) == 0)) //it is NOT inherited anyhow, so ignore too
|
||||
*itr = ::boost::winapi::INVALID_HANDLE_VALUE_;
|
||||
});
|
||||
|
||||
auto part_itr = std::partition(all_handles.begin(), all_handles.end(),
|
||||
|
||||
@@ -163,7 +163,7 @@ BOOST_PROCESS_V2_END_NAMESPACE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) && defined(BOOST_PROCESS_V2_ENABLE_PDFORK)
|
||||
#if defined(__FreeBSD__) && !defined(BOOST_PROCESS_V2_DISABLE_PDFORK)
|
||||
#define BOOST_PROCESS_V2_PDFORK 1
|
||||
#define BOOST_PROCESS_V2_HAS_PROCESS_HANDLE 1
|
||||
#endif
|
||||
|
||||
@@ -315,9 +315,13 @@ struct basic_process_handle_fd_or_signal
|
||||
|
||||
struct async_wait_op_
|
||||
{
|
||||
net::posix::basic_descriptor<Executor> &descriptor;
|
||||
net::posix::basic_stream_descriptor<Executor> &descriptor;
|
||||
net::basic_signal_set<Executor> &handle;
|
||||
pid_type pid_;
|
||||
async_wait_op_(net::posix::basic_stream_descriptor<Executor> &descriptor,
|
||||
net::basic_signal_set<Executor> &handle,
|
||||
pid_type pid_) : descriptor(descriptor), handle(handle), pid_(pid_) {}
|
||||
|
||||
bool needs_post = true;
|
||||
|
||||
template<typename Self>
|
||||
@@ -343,10 +347,11 @@ struct basic_process_handle_fd_or_signal
|
||||
|
||||
if (!ec && (wait_res == 0))
|
||||
{
|
||||
static char dummy[128];
|
||||
needs_post = false;
|
||||
if (descriptor.is_open())
|
||||
descriptor.async_wait(
|
||||
net::posix::descriptor_base::wait_read,
|
||||
descriptor.async_read_some(
|
||||
asio::buffer(dummy),
|
||||
std::move(self));
|
||||
else
|
||||
handle.async_wait(std::move(self));
|
||||
@@ -379,10 +384,10 @@ struct basic_process_handle_fd_or_signal
|
||||
WaitHandler = net::default_completion_token_t<executor_type>>
|
||||
auto async_wait(WaitHandler &&handler = net::default_completion_token_t<executor_type>())
|
||||
-> decltype(net::async_compose<WaitHandler, void(error_code, native_exit_code_type)>(
|
||||
async_wait_op_{descriptor_, signal_set_, pid_}, handler, descriptor_))
|
||||
async_wait_op_(descriptor_, signal_set_, pid_), handler, descriptor_))
|
||||
{
|
||||
return net::async_compose<WaitHandler, void(error_code, native_exit_code_type)>(
|
||||
async_wait_op_{descriptor_, signal_set_, pid_}, handler, descriptor_);
|
||||
async_wait_op_(descriptor_, signal_set_, pid_), handler, descriptor_);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ struct basic_process_handle_win
|
||||
public:
|
||||
template<BOOST_PROCESS_V2_COMPLETION_TOKEN_FOR(void(error_code, native_exit_code_type))
|
||||
WaitHandler = net::default_completion_token_t<executor_type>>
|
||||
auto async_wait(WaitHandler &&handler = net::default_completion_token_t<executor_type>())
|
||||
auto async_wait(WaitHandler &&handler = default_completion_token_t<executor_type>())
|
||||
-> decltype(net::async_compose<WaitHandler, void(error_code, native_exit_code_type)>(
|
||||
async_wait_op_{handle_}, handler, handle_))
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#if defined(__APPLE__) || defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun)
|
||||
#if defined(__APPLE__) || defined(__MACH__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
extern "C" { extern char **environ; }
|
||||
#endif
|
||||
|
||||
|
||||
@@ -389,7 +389,7 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
|
||||
argc++;
|
||||
return make_cmd_shell_::make(
|
||||
{}, argc, cmd,
|
||||
+[](int, char ** argv) {::free(argv);});
|
||||
+[](int, char ** argv) {::free(argv);})
|
||||
}
|
||||
else
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec);
|
||||
|
||||
13
src/pid.cpp
13
src/pid.cpp
@@ -52,7 +52,6 @@
|
||||
#endif
|
||||
|
||||
#if defined(__sun)
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <kvm.h>
|
||||
#include <sys/param.h>
|
||||
@@ -711,9 +710,9 @@ std::vector<pid_type> all_pids(boost::system::error_code & ec)
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec);
|
||||
return vec;
|
||||
}
|
||||
while ((proc_info = kvm_nextproc(kd.get())))
|
||||
while ((proc_info = kvm_nextproc(kd)))
|
||||
{
|
||||
if (kvm_kread(kd.get(), (std::uintptr_t)proc_info->p_pidp, &cur_pid, sizeof(cur_pid)) != -1)
|
||||
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);
|
||||
}
|
||||
@@ -745,7 +744,7 @@ pid_type parent_pid(pid_type pid, boost::system::error_code & ec)
|
||||
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec);
|
||||
return ppid;
|
||||
}
|
||||
if ((proc_info = kvm_getproc(kd.get(), pid)))
|
||||
if ((proc_info = kvm_getproc(kd, pid)))
|
||||
{
|
||||
ppid = proc_info->p_ppid;
|
||||
}
|
||||
@@ -768,17 +767,17 @@ std::vector<pid_type> child_pids(pid_type pid, boost::system::error_code & ec)
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<kvm_t, closer> kd{kvm_open(nullptr, nullptr, nullptr, O_RDONLY, nullptr)};
|
||||
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.get())))
|
||||
while ((proc_info = kvm_nextproc(kd)))
|
||||
{
|
||||
if (proc_info->p_ppid == pid)
|
||||
{
|
||||
if (kvm_kread(kd.get(), (std::uintptr_t)proc_info->p_pidp, &cur_pid, sizeof(cur_pid)) != -1)
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -148,17 +148,12 @@ BOOST_AUTO_TEST_CASE(async_nowait, *boost::unit_test::timeout(10))
|
||||
boost::asio::io_context io_context;
|
||||
bp::child c(
|
||||
master_test_suite().argv[1],
|
||||
"test", "--exit-code", "121",
|
||||
"test", "--exit-code", "221",
|
||||
ec,
|
||||
bp::on_exit=[](int exit_code, std::error_code) mutable {},
|
||||
io_context
|
||||
);
|
||||
BOOST_REQUIRE(!ec);
|
||||
while (c.running())
|
||||
{
|
||||
io_context.run_for(std::chrono::milliseconds(10));
|
||||
io_context.restart();
|
||||
}
|
||||
|
||||
BOOST_CHECK_EQUAL(121, c.exit_code());
|
||||
io_context.run_for(std::chrono::milliseconds(100));
|
||||
BOOST_CHECK_EQUAL(221, c.exit_code());
|
||||
}
|
||||
Reference in New Issue
Block a user