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

Fix building on OpenBSD

OpenBSD does not have close_range() nor does NetBSD.

OpenBSD needs environ like the other *BSD's.

The build was erroring on kp_pid, it looks like p_pid is appropriate.
This commit is contained in:
Brad Smith
2024-08-24 03:41:27 -04:00
committed by Klemens Morgenstern
parent 642bd7cf5c
commit 211a3134b6
3 changed files with 5 additions and 6 deletions

View File

@@ -29,7 +29,7 @@
#include <unistd.h>
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__APPLE__) || defined(__MACH__)
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__MACH__)
extern "C" { extern char **environ; }
#endif

View File

@@ -551,9 +551,9 @@ std::vector<pid_type> all_pids(boost::system::error_code & ec)
vec.reserve(cntp);
for (int i = cntp - 1; i >= 0; i--)
{
if (proc_info[i].kp_pid >= 0)
if (proc_info[i].p_pid >= 0)
{
vec.push_back(proc_info[i].kp_pid);
vec.push_back(proc_info[i].p_pid);
}
}
}

View File

@@ -17,10 +17,9 @@
// linux has close_range since 5.19
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
#if defined(__FreeBSD__)
// https://www.freebsd.org/cgi/man.cgi?query=close_range&apropos=0&sektion=0&manpath=FreeBSD+13.1-RELEASE+and+Ports&arch=default&format=html
// https://man.netbsd.org/closefrom.3
// __FreeBSD__
//
// gives us
@@ -219,4 +218,4 @@ void close_all(const std::vector<int> & whitelist, error_code & ec)
BOOST_PROCESS_V2_END_NAMESPACE
#endif
#endif