From 0ca663c8262b65ccee9a4e6abbafaef710f6b36f Mon Sep 17 00:00:00 2001 From: Klemens Morgenstern Date: Sun, 26 Jan 2025 21:49:25 +0800 Subject: [PATCH] Set ENOTSUP when PROC_PPID_ONLY is undefined closes #452 --- src/pid.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pid.cpp b/src/pid.cpp index 7fa5f822c..322405907 100644 --- libs/process/src/pid.cpp +++ libs/process/src/pid.cpp @@ -178,6 +178,8 @@ pid_type parent_pid(pid_type pid, error_code & ec) std::vector child_pids(pid_type pid, error_code & ec) { std::vector 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 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; }