summaryrefslogtreecommitdiff
path: root/absl/base/internal/sysinfo.cc
diff options
context:
space:
mode:
authorGravatar Derek Mauro <761129+derekmauro@users.noreply.github.com>2023-09-18 10:40:01 -0400
committerGravatar GitHub <noreply@github.com>2023-09-18 10:40:01 -0400
commitfb3621f4f897824c0dbe0615fa94543df6192f30 (patch)
treeeaf3e180790d3aed3947e7ddfdd22e5a349eaf58 /absl/base/internal/sysinfo.cc
parent29bf8085f3bf17b84d30e34b3d7ff8248fda404e (diff)
Abseil LTS branch, Aug 2023, Patch 1 (#1534)20230802.1
* Add StdcppWaiter to the end of the list of waiter implementations Since ABSL_INTERNAL_HAVE_STDCPP_WAITER is defined on all systems it is effectively a fallback. I left the condition there in case we have to disable it on some platform in the future. PiperOrigin-RevId: 555629066 Change-Id: I76ca78c7f36d1d02dc4950a44c66903a2aaf2a52 * Use native methods to implement absl::base_internal::GetPID() on FreeBSD, NetBSD, and OpenBSD https://man.freebsd.org/cgi/man.cgi?query=pthread_getthreadid_np https://man.netbsd.org/_lwp_self.2 https://man.openbsd.org/getthrid.2 * Abseil LTS branch, Aug 2023, Patch 1 Bump ABSL_LTS_RELEASE_PATCH_LEVEL to 1
Diffstat (limited to 'absl/base/internal/sysinfo.cc')
-rw-r--r--absl/base/internal/sysinfo.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc
index 8bcc4faf..79eaba3e 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
@@ -432,6 +440,18 @@ pid_t GetTID() {
return static_cast<pid_t>(tid);
}
+#elif defined(__FreeBSD__)
+
+pid_t GetTID() { return static_cast<pid_t>(pthread_getthreadid_np()); }
+
+#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() {