From: Brad Smith Subject: Re: UPDATE: Boost - getexecpath() To: ports@openbsd.org Date: Fri, 18 Sep 2026 17:21:59 -0400 On 2026-09-18 4:56 a.m., Kirill A. Korinsky wrote: > On Fri, 18 Sep 2026 09:04:01 +0200, > Brad Smith wrote: >> Here is a diff for Boost to fill in the other spots where >> getexecpath() is relevant. >> >> >> Index: Makefile >> =================================================================== >> RCS file: /cvs/ports/devel/boost/Makefile,v >> retrieving revision 1.164 >> diff -u -p -u -p -r1.164 Makefile >> --- Makefile 15 Sep 2026 10:21:13 -0000 1.164 >> +++ Makefile 17 Sep 2026 06:50:59 -0000 >> @@ -13,7 +13,7 @@ CATEGORIES= devel >> SITES= https://archives.boost.io/release/${VERSION}/source/ >> EXTRACT_SUFX= .tar.bz2 >> >> -REVISION-main= 0 >> +REVISION= 1 >> >> SO_VERSION= 27.0 >> BOOST_LIBS= boost_atomic-mt \ >> Index: patches/patch-boost_dll_detail_posix_program_location_impl_hpp >> =================================================================== >> RCS file: /cvs/ports/devel/boost/patches/patch-boost_dll_detail_posix_program_location_impl_hpp,v >> retrieving revision 1.1 >> diff -u -p -u -p -r1.1 patch-boost_dll_detail_posix_program_location_impl_hpp >> --- patches/patch-boost_dll_detail_posix_program_location_impl_hpp 15 Sep 2026 10:21:13 -0000 1.1 >> +++ patches/patch-boost_dll_detail_posix_program_location_impl_hpp 17 Sep 2026 06:50:59 -0000 >> @@ -1,19 +1,28 @@ >> -Add support of getexecpath() >> +Add support for getexecpath() >> >> Index: boost/dll/detail/posix/program_location_impl.hpp >> --- boost/dll/detail/posix/program_location_impl.hpp.orig >> +++ boost/dll/detail/posix/program_location_impl.hpp >> -@@ -96,6 +96,30 @@ namespace boost { namespace dll { namespace detail { >> +@@ -16,6 +16,10 @@ >> + # pragma once >> + #endif >> >> ++#if BOOST_OS_BSD_OPEN >> ++#include >> ++#endif >> ++ >> + #if BOOST_OS_MACOS || BOOST_OS_IOS >> >> + #include >> +@@ -94,7 +98,27 @@ namespace boost { namespace dll { namespace detail { >> + } >> + }}} // namespace boost::dll::detail >> + >> ++#elif BOOST_OS_BSD_OPEN && BSD >= 202610 >> >> -+#elif BOOST_OS_BSD_OPEN >> -+ >> -+#if !defined(BOOST_DLL_INTERFACE_UNIT) >> +#include >> +#include >> +#include >> -+#endif // !defined(BOOST_DLL_INTERFACE_UNIT) >> + >> +namespace boost { namespace dll { namespace detail { >> + inline boost::dll::fs::path program_location_impl(std::error_code& ec) { >> @@ -30,7 +39,6 @@ Index: boost/dll/detail/posix/program_lo >> + return boost::dll::fs::path(path); >> + } >> +}}} // namespace boost::dll::detail >> -+ >> + >> #elif BOOST_OS_BSD_NET >> >> - namespace boost { namespace dll { namespace detail { >> Index: patches/patch-libs_log_src_process_name_cpp >> =================================================================== >> RCS file: patches/patch-libs_log_src_process_name_cpp >> diff -N patches/patch-libs_log_src_process_name_cpp >> --- /dev/null 1 Jan 1970 00:00:00 -0000 >> +++ patches/patch-libs_log_src_process_name_cpp 17 Sep 2026 06:50:59 -0000 >> @@ -0,0 +1,55 @@ >> +Add support for getexecpath() >> + >> +Index: libs/log/src/process_name.cpp >> +--- libs/log/src/process_name.cpp.orig >> ++++ libs/log/src/process_name.cpp >> +@@ -26,6 +26,10 @@ >> + #define PATH_MAX 1024 >> + #endif >> + >> ++#ifdef __OpenBSD__ >> ++#include >> ++#endif >> ++ >> + #if defined(BOOST_WINDOWS) >> + >> + #include >> +@@ -138,6 +142,38 @@ BOOST_LOG_API std::string get_process_name() >> + return filesystem::read_symlink("/proc/curproc/file").filename().string(); >> + >> + return std::to_string(getpid()); >> ++} >> ++ >> ++} // namespace aux >> ++ >> ++BOOST_LOG_CLOSE_NAMESPACE // namespace log >> ++ >> ++} // namespace boost >> ++ >> ++#include >> ++ >> ++#elif defined(__OpenBSD__) && BSD >= 202610 >> ++ >> ++#include >> ++ >> ++namespace boost { >> ++ >> ++BOOST_LOG_OPEN_NAMESPACE >> ++ >> ++namespace aux { >> ++ >> ++//! The function returns the current process name >> ++BOOST_LOG_API std::string get_process_name() >> ++{ >> ++ std::string buf(PATH_MAX, '\0'); >> ++ >> ++ if (getexecpath(&buf[0], buf.size()) == 0) >> ++ { >> ++ buf.resize(std::strlen(&buf[0])); >> ++ return filesystem::path(buf).filename().string(); >> ++ } >> ++ >> ++ return std::string(); >> + } >> + >> + } // namespace aux >> Index: patches/patch-tools_build_src_engine_pathsys_cpp >> =================================================================== >> RCS file: patches/patch-tools_build_src_engine_pathsys_cpp >> diff -N patches/patch-tools_build_src_engine_pathsys_cpp >> --- /dev/null 1 Jan 1970 00:00:00 -0000 >> +++ patches/patch-tools_build_src_engine_pathsys_cpp 17 Sep 2026 06:50:59 -0000 >> @@ -0,0 +1,28 @@ >> +Add support for getexecpath() >> + >> +Index: tools/build/src/engine/pathsys.cpp >> +--- tools/build/src/engine/pathsys.cpp.orig >> ++++ tools/build/src/engine/pathsys.cpp >> +@@ -38,6 +38,9 @@ >> + >> + #include >> + >> ++#ifdef __OpenBSD__ >> ++#include >> ++#endif >> + >> + /* Internal OS specific implementation details - have names ending with an >> + * underscore and are expected to be implemented in an OS specific pathXXX.c >> +@@ -421,6 +424,12 @@ char * executable_path( char const * argv0 ) >> + size_t size = sizeof( buf ); >> + sysctl( mib, 4, buf, &size, NULL, 0 ); >> + return ( !size || size == sizeof( buf ) ) ? NULL : strndup( buf, size ); >> ++} >> ++#elif defined(__OpenBSD__) && BSD >= 202610 >> ++char * executable_path( char const * argv0 ) >> ++{ >> ++ char buf[ 1024 ]; > Why do not use PATH_MAX here? Using the same style as all of the other entries. >> ++ return getexecpath( buf, sizeof( buf ) ) == -1 ? NULL : strdup( buf ); >> + } >> + #elif defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__) >> + # include >>