From 92250edfc51b255c09c27a7801d5eed69ecb099c Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Tue, 1 Jun 2021 17:37:09 -0400 Subject: [PATCH] Make ADIOS2 build on FreeBSD --- source/adios2/helper/adiosComm.inl | 1 + source/adios2/helper/adiosNetwork.cpp | 11 ++++++----- .../toolkit/profiling/taustubs/tautimer.cpp | 16 ++++++++++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/source/adios2/helper/adiosComm.inl b/source/adios2/helper/adiosComm.inl index 0ff88d892c..64918feb14 100644 --- a/source/adios2/helper/adiosComm.inl +++ b/source/adios2/helper/adiosComm.inl @@ -13,6 +13,7 @@ #include //std::accumulate #include //std::runtime_error +#include //std::to_string #include //std::pair namespace adios2 diff --git a/source/adios2/helper/adiosNetwork.cpp b/source/adios2/helper/adiosNetwork.cpp index 9122224e06..d966a10e6f 100644 --- a/source/adios2/helper/adiosNetwork.cpp +++ b/source/adios2/helper/adiosNetwork.cpp @@ -18,11 +18,12 @@ #include #include -#include //AvailableIpAddresses() inet_ntoa -#include //AvailableIpAddresses() struct if_nameindex -#include //AvailableIpAddresses() strncp -#include //AvailableIpAddresses() ioctl -#include //AvailableIpAddresses() close +#include //AvailableIpAddresses() inet_ntoa +#include //AvailableIpAddresses() struct if_nameindex +#include //AvailableIpAddresses() struct sockaddr_in +#include //AvailableIpAddresses() strncp +#include //AvailableIpAddresses() ioctl +#include //AvailableIpAddresses() close #include diff --git a/source/adios2/toolkit/profiling/taustubs/tautimer.cpp b/source/adios2/toolkit/profiling/taustubs/tautimer.cpp index 1837290b4d..fb0d669edb 100644 --- a/source/adios2/toolkit/profiling/taustubs/tautimer.cpp +++ b/source/adios2/toolkit/profiling/taustubs/tautimer.cpp @@ -22,6 +22,10 @@ #include #include +#if defined(__FreeBSD__) +#include +#endif + /* Clean assertion handling */ inline void _tautimer_assert(const char *expression, const char *file, int line) { @@ -199,12 +203,14 @@ thread_local bool TauTimer::thread_seen(false); // constructor TauTimer::TauTimer(void) : initialized(false) { - // Confirm that we are instantializing this singleton on the main thread! + // Confirm that we are instantiating this singleton on the main thread! mypid = getpid(); #if defined(__APPLE__) && defined(__MACH__) - // why should Apple support gettid? BE DIFFERENT, BABY! pthread_threadid_np(NULL, &mytid); +#elif defined(__FreeBSD__) + mytid = pthread_getthreadid_np(); #else + // __NR_gettid is Linux-only mytid = (uint64_t)syscall(__NR_gettid); #endif if (tau_stub_initialize_simple_() == 0) @@ -228,11 +234,13 @@ inline void TauTimer::_RegisterThread(void) { if (!thread_seen) { -// Confirm that we are NOT on the main thread! + // Confirm that we are NOT on the main thread! #if defined(__APPLE__) && defined(__MACH__) - // why should Apple support gettid? BE DIFFERENT, BABY! pthread_threadid_np(NULL, &mytid); +#elif defined(__FreeBSD__) + mytid = pthread_getthreadid_np(); #else + // __NR_gettid is Linux-only mytid = (uint64_t)syscall(__NR_gettid); #endif my_Tau_register_thread();