Commit b9707b7d by Derek Mauro Committed by Copybara-Service

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

This fixes a build break caused by
https://github.com/abseil/abseil-cpp/commit/88cc63ef739d83277b492e881be72e9069fcb1fe

Fixes #1518

PiperOrigin-RevId: 563200172
Change-Id: Ifd1b65c84e3631075248bc2e01b8f047dc72d201
parent a74b796a
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment