Selaa lähdekoodia

Fix sysctl and CI on FreeBSD

default_compile_flags
vector-of-bool 3 vuotta sitten
vanhempi
commit
66753f023e
2 muutettua tiedostoa jossa 17 lisäystä ja 7 poistoa
  1. +11
    -7
      src/dds/cli/cmd/install_yourself.cpp
  2. +6
    -0
      tools/dds_ci/toolchain.py

+ 11
- 7
src/dds/cli/cmd/install_yourself.cpp Näytä tiedosto

@@ -15,6 +15,8 @@
#ifdef __APPLE__
#include <mach-o/dyld.h>
#elif __FreeBSD__
#include <sys/types.h>
// <sys/types.h> must come first
#include <sys/sysctl.h>
#elif _WIN32
#include <windows.h>
@@ -41,20 +43,22 @@ fs::path current_executable() {
return fs::canonical(buffer);
#elif __FreeBSD__
std::string buffer;
int mib[] = {CTRL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
std::size_t len = 0;
auto rc = ::sysctl(mib, 4, nullptr, &len, nullptr, 0);
int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
std::size_t len = 0;
auto rc = ::sysctl(mib, 4, nullptr, &len, nullptr, 0);
auto errno_ = errno;
neo_assert(invariant,
rc == 0,
"Unexpected error from ::sysctl() while getting executable path",
errno);
errno_);
buffer.resize(len + 1);
rc = ::sysctl(mib, 4, buffer.data(), &len, nullptr, 0);
rc = ::sysctl(mib, 4, buffer.data(), &len, nullptr, 0);
errno_ = errno;
neo_assert(invariant,
rc == 0,
"Unexpected error from ::sysctl() while getting executable path",
errno);
return fs::canonical(nullptr);
errno_);
return fs::canonical(buffer);
#elif _WIN32
std::wstring buffer;
while (true) {

+ 6
- 0
tools/dds_ci/toolchain.py Näytä tiedosto

@@ -47,6 +47,8 @@ def get_default_audit_toolchain() -> Path:
return paths.TOOLS_DIR / 'gcc-9-audit.jsonc'
if sys.platform == 'darwin':
return paths.TOOLS_DIR / 'gcc-9-audit-macos.jsonc'
if sys.platform == 'freebsd11':
return paths.TOOLS_DIR / 'freebsd-gcc-10.jsonc'
raise RuntimeError(f'Unable to determine the default toolchain (sys.platform is {sys.platform!r})')


@@ -59,6 +61,8 @@ def get_default_test_toolchain() -> Path:
return paths.TESTS_DIR / 'msvc.tc.jsonc'
if sys.platform in ('linux', 'darwin'):
return paths.TESTS_DIR / 'gcc-9.tc.jsonc'
if sys.platform == 'freebsd11':
return paths.TOOLS_DIR / 'freebsd-gcc-10.jsonc'
raise RuntimeError(f'Unable to determine the default toolchain (sys.platform is {sys.platform!r})')


@@ -73,4 +77,6 @@ def get_default_toolchain() -> Path:
return paths.TOOLS_DIR / 'gcc-9-rel.jsonc'
if sys.platform == 'darwin':
return paths.TOOLS_DIR / 'gcc-9-rel-macos.jsonc'
if sys.platform == 'freebsd11':
return paths.TOOLS_DIR / 'freebsd-gcc-10.jsonc'
raise RuntimeError(f'Unable to determine the default toolchain (sys.platform is {sys.platform!r})')

Loading…
Peruuta
Tallenna