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

Set ENOTSUP when PROC_PPID_ONLY is undefined

closes #452
This commit is contained in:
Klemens Morgenstern
2025-01-26 21:49:25 +08:00
parent a2d2753aa8
commit 0ca663c826

View File

@@ -178,6 +178,8 @@ pid_type parent_pid(pid_type pid, error_code & ec)
std::vector<pid_type> child_pids(pid_type pid, error_code & ec)
{
std::vector<pid_type> vec;
#if defined(PROC_PPID_ONLY)
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)
@@ -186,6 +188,9 @@ std::vector<pid_type> child_pids(pid_type pid, error_code & ec)
return {};
}
vec.resize(sz);
#else
BOOST_PROCESS_V2_ASSIGN_EC(ec, ENOTSUP, system_category());
#endif
return vec;
}