On Fri, 18 Sep 2026 03:04:01 -0400
Brad Smith <[email protected]> wrote:

> Here is a diff for Boost to fill in the other spots where
> getexecpath() is relevant.

[...]

> + }}} // namespace boost::dll::detail
> + 
> ++#elif BOOST_OS_BSD_OPEN && BSD >= 202610

Shouldn't this be:

#elif BOOST_OS_BSD_OPEN && OpenBSD >= 202610

?

A test program seems to confirm my suspicion:

BSD: 199306, OpenBSD: 202610

>   
> -+#elif BOOST_OS_BSD_OPEN
> -+
> -+#if !defined(BOOST_DLL_INTERFACE_UNIT)
>  +#include <errno.h>
>  +#include <limits.h>
>  +#include <unistd.h>
> -+#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 <sys/param.h>
> ++#endif
> ++
> + #if defined(BOOST_WINDOWS)
> + 
> + #include <windows.h>
> +@@ -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 <boost/log/detail/footer.hpp>
> ++
> ++#elif defined(__OpenBSD__) && BSD >= 202610

ditto here

> ++
> ++#include <unistd.h>
> ++
> ++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 <algorithm>
> + 
> ++#ifdef __OpenBSD__
> ++#include <sys/param.h>
> ++#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

ditto

> ++char * executable_path( char const * argv0 )
> ++{
> ++    char buf[ 1024 ];
> ++    return getexecpath( buf, sizeof( buf ) ) == -1 ? NULL : strdup(
> buf );
> + }
> + #elif defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__)
> + # include <unistd.h>
> 

Reply via email to