summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--absl/base/internal/sysinfo.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc
index 8bcc4faf..5b427fa5 100644
--- a/absl/base/internal/sysinfo.cc
+++ b/absl/base/internal/sysinfo.cc
@@ -34,6 +34,14 @@
#include <sys/sysctl.h>
#endif
+#ifdef __FreeBSD__
+#include <pthread_np.h>
+#endif
+
+#ifdef __NetBSD__
+#include <lwp.h>
+#endif
+
#if defined(__myriad2__)
#include <rtems.h>
#endif
@@ -421,7 +429,7 @@ pid_t GetTID() {
return tid;
}
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__FreeBSD__)
pid_t GetTID() {
uint64_t tid;
@@ -432,6 +440,14 @@ pid_t GetTID() {
return static_cast<pid_t>(tid);
}
+#elif defined(__OpenBSD__)
+
+pid_t GetTID() { return getthrid(); }
+
+#elif defined(__NetBSD__)
+
+pid_t GetTID() { return static_cast<pid_t>(_lwp_self()); }
+
#elif defined(__native_client__)
pid_t GetTID() {