Add support for BSD systems
webrtc/rtc_base/checks.cc:158:28: error: use of undeclared identifier 'LAST_SYSTEM_ERROR' 158 | file, line, LAST_SYSTEM_ERROR, message); | ^ webrtc/rtc_base/checks.cc:220:16: error: use of undeclared identifier 'LAST_SYSTEM_ERROR' 220 | LAST_SYSTEM_ERROR); | ^ In file included from webrtc/rtc_base/platform_thread_types.cc:11: webrtc/rtc_base/platform_thread_types.h:47:1: error: unknown type name 'PlatformThreadId' 47 | PlatformThreadId CurrentThreadId(); | ^ webrtc/rtc_base/platform_thread_types.h:52:1: error: unknown type name 'PlatformThreadRef' 52 | PlatformThreadRef CurrentThreadRef(); | ^ webrtc/rtc_base/platform_thread_types.h:55:29: error: unknown type name 'PlatformThreadRef' 55 | bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b); | ^ webrtc/rtc_base/platform_thread_types.h:55:57: error: unknown type name 'PlatformThreadRef' 55 | bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b); | ^ webrtc/rtc_base/platform_thread_types.cc:37:1: error: unknown type name 'PlatformThreadId' 37 | PlatformThreadId CurrentThreadId() { | ^ webrtc/rtc_base/platform_thread_types.cc:58:1: error: unknown type name 'PlatformThreadRef' 58 | PlatformThreadRef CurrentThreadRef() { | ^ webrtc/rtc_base/platform_thread_types.cc:68:29: error: unknown type name 'PlatformThreadRef' 68 | bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b) { | ^ webrtc/rtc_base/platform_thread_types.cc:68:57: error: unknown type name 'PlatformThreadRef' 68 | bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b) { | ^ In file included from webrtc/rtc_base/event_tracer.cc:30: In file included from webrtc/api/sequence_checker.h:15: In file included from webrtc/rtc_base/synchronization/sequence_checker_internal.h:18: webrtc/rtc_base/synchronization/mutex.h:28:2: error: Unsupported platform. 28 | #error Unsupported platform. | ^ webrtc/rtc_base/synchronization/mutex.h:52:3: error: unknown type name 'MutexImpl' 52 | MutexImpl impl_; | ^
This commit is contained in:
@ -15,6 +15,12 @@
|
||||
#include <sys/syscall.h>
|
||||
#endif
|
||||
|
||||
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
|
||||
#include <pthread_np.h>
|
||||
#elif defined(__NetBSD__) // WEBRTC_BSD
|
||||
#include <lwp.h>
|
||||
#endif
|
||||
|
||||
#if defined(WEBRTC_WIN)
|
||||
#include "rtc_base/arraysize.h"
|
||||
|
||||
@ -46,6 +52,12 @@ PlatformThreadId CurrentThreadId() {
|
||||
return zx_thread_self();
|
||||
#elif defined(WEBRTC_LINUX)
|
||||
return syscall(__NR_gettid);
|
||||
#elif defined(__DragonFly__) || defined(__FreeBSD__) // WEBRTC_BSD
|
||||
return pthread_getthreadid_np();
|
||||
#elif defined(__NetBSD__) // WEBRTC_BSD
|
||||
return _lwp_self();
|
||||
#elif defined(__OpenBSD__) // WEBRTC_BSD
|
||||
return getthrid();
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
return static_cast<PlatformThreadId>(pthread_self());
|
||||
#else
|
||||
@ -116,6 +128,10 @@ void SetCurrentThreadName(const char* name) {
|
||||
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name)); // NOLINT
|
||||
#elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
|
||||
pthread_setname_np(name);
|
||||
#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
|
||||
pthread_set_name_np(pthread_self(), name);
|
||||
#elif defined(__NetBSD__) // WEBRTC_BSD
|
||||
pthread_setname_np(pthread_self(), "%s", (void*)name);
|
||||
#elif defined(WEBRTC_FUCHSIA)
|
||||
zx_status_t status = zx_object_set_property(zx_thread_self(), ZX_PROP_NAME,
|
||||
name, strlen(name));
|
||||
|
Reference in New Issue
Block a user