Skip to content

Commit 0b01880

Browse files
devnexenkevinAlbs
authored andcommitted
BSD more friendly build.
Using native feature for proper TID report.
1 parent 5e7822e commit 0b01880

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/libmongoc/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,10 @@ if (ENABLE_SHM_COUNTERS STREQUAL "ON")
340340
"Shared memory performance counters not supported on Mac or Windows")
341341
endif ()
342342
set (MONGOC_ENABLE_SHM_COUNTERS 1)
343-
set (SHM_LIBRARIES rt)
343+
find_library(RT_LIBRARY rt)
344+
if (RT_LIBRARY)
345+
set (SHM_LIBRARIES rt)
346+
endif ()
344347
endif ()
345348

346349
if (NOT ENABLE_ICU MATCHES "AUTO|ON|OFF")

src/libmongoc/src/mongoc/mongoc-log.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <sys/syscall.h>
2020
#elif defined(_WIN32)
2121
#include <process.h>
22+
#elif defined(__FreeBSD__)
23+
#include <sys/thr.h>
2224
#else
2325
#include <unistd.h>
2426
#endif
@@ -171,6 +173,12 @@ mongoc_log_default_handler (mongoc_log_level_t log_level,
171173
pid = syscall (SYS_gettid);
172174
#elif defined(_WIN32)
173175
pid = (int) _getpid ();
176+
#elif defined(__FreeBSD__)
177+
long tid;
178+
thr_self (&tid);
179+
pid = (int) tid;
180+
#elif defined(__OpenBSD__)
181+
pid = (int) getthrid ();
174182
#else
175183
pid = (int) getpid ();
176184
#endif

0 commit comments

Comments
 (0)