mirror of
https://git.freebsd.org/ports.git
synced 2025-07-10 13:59:22 -04:00
111 lines
3 KiB
Text
111 lines
3 KiB
Text
From b9707b7d7845f9710ae6d5906827b833fdcc2754 Mon Sep 17 00:00:00 2001
|
|
From: Derek Mauro <dmauro@google.com>
|
|
Date: Wed, 6 Sep 2023 13:30:04 -0700
|
|
Subject: [PATCH] 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
|
|
---
|
|
absl/base/internal/sysinfo.cc | 18 +++++++++++++++++-
|
|
1 file changed, 17 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc
|
|
index 8bcc4fafaf9..5b427fa5e98 100644
|
|
--- ../../src/webrtc/src/third_party/abseil-cpp/absl/base/internal/sysinfo.cc
|
|
+++ ../../src/webrtc/src/third_party/abseil-cpp/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() {
|
|
|
|
|
|
|
|
|
|
From b020fe646186aa624e607a23baca445ba8cd199e Mon Sep 17 00:00:00 2001
|
|
From: Derek Mauro <dmauro@google.com>
|
|
Date: Thu, 7 Sep 2023 08:02:09 -0700
|
|
Subject: [PATCH] Fix GetTID() on FreeBSD
|
|
|
|
https://github.com/abseil/abseil-cpp/issues/1518#issuecomment-1709098904
|
|
pointed out that the previous untested fix doesn't work because
|
|
pthread_getthreadid_np() has a different signature on Darwin.
|
|
|
|
Follow up to https://github.com/abseil/abseil-cpp/commit/b9707b7d7845f9710ae6d5906827b833fdcc2754
|
|
|
|
Fixes #1518
|
|
|
|
PiperOrigin-RevId: 563432451
|
|
Change-Id: Id0a9212e9c4413fa520a42934efaed2a06ca5dbc
|
|
---
|
|
absl/base/internal/sysinfo.cc | 6 +++++-
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc
|
|
index 5b427fa5e98..79eaba3e51c 100644
|
|
--- ../../src/webrtc/src/third_party/abseil-cpp/absl/base/internal/sysinfo.cc
|
|
+++ ../../src/webrtc/src/third_party/abseil-cpp/absl/base/internal/sysinfo.cc
|
|
@@ -429,7 +429,7 @@ pid_t GetTID() {
|
|
return tid;
|
|
}
|
|
|
|
-#elif defined(__APPLE__) || defined(__FreeBSD__)
|
|
+#elif defined(__APPLE__)
|
|
|
|
pid_t GetTID() {
|
|
uint64_t tid;
|
|
@@ -440,6 +440,10 @@ 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(); }
|