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:
@ -87,6 +87,11 @@ elif host_system == 'linux'
|
|||||||
os_deps += [cc.find_library('rt', required : false)]
|
os_deps += [cc.find_library('rt', required : false)]
|
||||||
os_deps += [dependency('threads')]
|
os_deps += [dependency('threads')]
|
||||||
have_posix = true
|
have_posix = true
|
||||||
|
elif (host_system == 'dragonfly' or host_system == 'freebsd' or
|
||||||
|
host_system == 'netbsd' or host_system == 'openbsd')
|
||||||
|
os_cflags += ['-DWEBRTC_BSD', '-DWEBRTC_THREAD_RR']
|
||||||
|
os_deps += [dependency('threads')]
|
||||||
|
have_posix = true
|
||||||
elif host_system == 'windows'
|
elif host_system == 'windows'
|
||||||
platform_cflags += ['-DWEBRTC_WIN', '-D_WIN32']
|
platform_cflags += ['-DWEBRTC_WIN', '-D_WIN32']
|
||||||
# this one is for MinGW to get format specifiers from inttypes.h in C++
|
# this one is for MinGW to get format specifiers from inttypes.h in C++
|
||||||
|
@ -15,6 +15,12 @@
|
|||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#endif
|
#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)
|
#if defined(WEBRTC_WIN)
|
||||||
#include "rtc_base/arraysize.h"
|
#include "rtc_base/arraysize.h"
|
||||||
|
|
||||||
@ -46,6 +52,12 @@ PlatformThreadId CurrentThreadId() {
|
|||||||
return zx_thread_self();
|
return zx_thread_self();
|
||||||
#elif defined(WEBRTC_LINUX)
|
#elif defined(WEBRTC_LINUX)
|
||||||
return syscall(__NR_gettid);
|
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__)
|
#elif defined(__EMSCRIPTEN__)
|
||||||
return static_cast<PlatformThreadId>(pthread_self());
|
return static_cast<PlatformThreadId>(pthread_self());
|
||||||
#else
|
#else
|
||||||
@ -116,6 +128,10 @@ void SetCurrentThreadName(const char* name) {
|
|||||||
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name)); // NOLINT
|
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name)); // NOLINT
|
||||||
#elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
|
#elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
|
||||||
pthread_setname_np(name);
|
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)
|
#elif defined(WEBRTC_FUCHSIA)
|
||||||
zx_status_t status = zx_object_set_property(zx_thread_self(), ZX_PROP_NAME,
|
zx_status_t status = zx_object_set_property(zx_thread_self(), ZX_PROP_NAME,
|
||||||
name, strlen(name));
|
name, strlen(name));
|
||||||
|
Reference in New Issue
Block a user