Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2019 01:16:25 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r506330 - in head: audio/webrtc-audio-processing/files devel/android-tools-adb/files devel/android-tools-fastboot/files devel/android-tools-simpleperf/files multimedia/gmmlib/files mult...
Message-ID:  <201907100116.x6A1GP5w002995@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Wed Jul 10 01:16:24 2019
New Revision: 506330
URL: https://svnweb.freebsd.org/changeset/ports/506330

Log:
  Add more gettid() aliases to my ports
  
  https://man.openbsd.org/getthrid.2
  https://illumos.org/man/3C/thr_self

Modified:
  head/audio/webrtc-audio-processing/files/patch-webrtc_base_platform__thread.cc   (contents, props changed)
  head/devel/android-tools-adb/files/patch-base_logging.cpp   (contents, props changed)
  head/devel/android-tools-adb/files/patch-libcutils_threads.cpp   (contents, props changed)
  head/devel/android-tools-fastboot/files/patch-base_logging.cpp   (contents, props changed)
  head/devel/android-tools-simpleperf/files/patch-base_logging.cpp   (contents, props changed)
  head/multimedia/gmmlib/files/patch-thread-id   (contents, props changed)
  head/multimedia/libva-intel-media-driver/files/patch-thread-id   (contents, props changed)
  head/multimedia/libva/files/patch-va_va__trace.c   (contents, props changed)

Modified: head/audio/webrtc-audio-processing/files/patch-webrtc_base_platform__thread.cc
==============================================================================
--- head/audio/webrtc-audio-processing/files/patch-webrtc_base_platform__thread.cc	Wed Jul 10 01:16:13 2019	(r506329)
+++ head/audio/webrtc-audio-processing/files/patch-webrtc_base_platform__thread.cc	Wed Jul 10 01:16:24 2019	(r506330)
@@ -16,7 +16,7 @@
  namespace rtc {
  
  PlatformThreadId CurrentThreadId() {
-@@ -32,9 +38,15 @@ PlatformThreadId CurrentThreadId() {
+@@ -32,6 +38,12 @@ PlatformThreadId CurrentThreadId() {
    ret =  syscall(__NR_gettid);
  #elif defined(WEBRTC_ANDROID)
    ret = gettid();
@@ -24,16 +24,12 @@
 +  ret = pthread_getthreadid_np();
 +#elif defined(__NetBSD__) // WEBRTC_BSD
 +  ret = _lwp_self();
++#elif defined(__OpenBSD__) // WEBRTC_BSD
++  ret = getthrid();
  #else
    // Default implementation for nacl and solaris.
--  ret = reinterpret_cast<pid_t>(pthread_self());
-+  // WEBRTC_BSD: pthread_t is a pointer, so cannot be casted to pid_t
-+  //             (aka int32_t) on 64-bit archs. Required on OpenBSD.
-+  ret = reinterpret_cast<uintptr_t>(pthread_self());
- #endif
- #endif  // defined(WEBRTC_POSIX)
-   RTC_DCHECK(ret);
-@@ -76,6 +90,10 @@ void SetCurrentThreadName(const char* name) {
+   ret = reinterpret_cast<pid_t>(pthread_self());
+@@ -76,6 +88,10 @@ void SetCurrentThreadName(const char* name) {
    prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name));
  #elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
    pthread_setname_np(name);

Modified: head/devel/android-tools-adb/files/patch-base_logging.cpp
==============================================================================
--- head/devel/android-tools-adb/files/patch-base_logging.cpp	Wed Jul 10 01:16:13 2019	(r506329)
+++ head/devel/android-tools-adb/files/patch-base_logging.cpp	Wed Jul 10 01:16:24 2019	(r506330)
@@ -18,7 +18,7 @@
  #include <iostream>
  #include <limits>
  #include <sstream>
-@@ -71,6 +72,12 @@
+@@ -71,6 +72,16 @@
  #include <unistd.h>
  #elif defined(_WIN32)
  #include <windows.h>
@@ -26,12 +26,16 @@
 +#include <pthread_np.h>
 +#elif defined(__NetBSD__)
 +#include <lwp.h>
-+#else // OpenBSD, Solaris
++#elif defined(__OpenBSD__)
++#include <unistd.h>
++#elif defined(__sun)
++#include <thread.h>
++#else // fallback
 +#include <stdint.h>
  #endif
  
  #if defined(_WIN32)
-@@ -88,6 +97,12 @@ static thread_id GetThreadId() {
+@@ -88,6 +97,16 @@ static thread_id GetThreadId() {
    return syscall(__NR_gettid);
  #elif defined(_WIN32)
    return GetCurrentThreadId();
@@ -39,7 +43,11 @@
 +  return pthread_getthreadid_np();
 +#elif defined(__NetBSD__)
 +  return _lwp_self();
-+#else // OpenBSD, Solaris
++#elif defined(__OpenBSD__)
++  return getthrid();
++#elif defined(__sun)
++  return thr_self();
++#else // fallback
 +  return (intptr_t) pthread_self();
  #endif
  }

Modified: head/devel/android-tools-adb/files/patch-libcutils_threads.cpp
==============================================================================
--- head/devel/android-tools-adb/files/patch-libcutils_threads.cpp	Wed Jul 10 01:16:13 2019	(r506329)
+++ head/devel/android-tools-adb/files/patch-libcutils_threads.cpp	Wed Jul 10 01:16:24 2019	(r506330)
@@ -1,6 +1,6 @@
 --- libcutils/threads.cpp.orig	2018-07-13 19:58:45 UTC
 +++ libcutils/threads.cpp
-@@ -24,11 +24,17 @@
+@@ -24,11 +24,21 @@
  #include <sys/syscall.h>
  #include <sys/time.h>
  #include <unistd.h>
@@ -8,17 +8,21 @@
 +#include <pthread_np.h>
 +#elif defined(__NetBSD__)
 +#include <lwp.h>
++#elif defined(__OpenBSD__)
++#include <unistd.h>
++#elif defined(__sun)
++#include <thread.h>
  #elif defined(__linux__) && !defined(__ANDROID__)
  #include <syscall.h>
  #include <unistd.h>
  #elif defined(_WIN32)
  #include <windows.h>
-+#else // OpenBSD, Solaris
++#else // fallback
 +#include <stdint.h>
  #endif
  
  // No definition needed for Android because we'll just pick up bionic's copy.
-@@ -38,10 +46,16 @@ pid_t gettid() {
+@@ -38,10 +46,20 @@ pid_t gettid() {
    uint64_t tid;
    pthread_threadid_np(NULL, &tid);
    return tid;
@@ -26,11 +30,15 @@
 +  return pthread_getthreadid_np();
 +#elif defined(__NetBSD__)
 +  return _lwp_self();
++#elif defined(__OpenBSD__)
++  return getthrid();
++#elif defined(__sun)
++  return thr_self();
  #elif defined(__linux__)
    return syscall(__NR_gettid);
  #elif defined(_WIN32)
    return GetCurrentThreadId();
-+#else // OpenBSD, Solaris
++#else // fallback
 +  return (intptr_t) pthread_self();
  #endif
  }

Modified: head/devel/android-tools-fastboot/files/patch-base_logging.cpp
==============================================================================
--- head/devel/android-tools-fastboot/files/patch-base_logging.cpp	Wed Jul 10 01:16:13 2019	(r506329)
+++ head/devel/android-tools-fastboot/files/patch-base_logging.cpp	Wed Jul 10 01:16:24 2019	(r506330)
@@ -18,7 +18,7 @@
  #include <iostream>
  #include <limits>
  #include <sstream>
-@@ -71,6 +72,12 @@
+@@ -71,6 +72,16 @@
  #include <unistd.h>
  #elif defined(_WIN32)
  #include <windows.h>
@@ -26,12 +26,16 @@
 +#include <pthread_np.h>
 +#elif defined(__NetBSD__)
 +#include <lwp.h>
-+#else // OpenBSD, Solaris
++#elif defined(__OpenBSD__)
++#include <unistd.h>
++#elif defined(__sun)
++#include <thread.h>
++#else // fallback
 +#include <stdint.h>
  #endif
  
  #if defined(_WIN32)
-@@ -88,6 +97,12 @@ static thread_id GetThreadId() {
+@@ -88,6 +97,16 @@ static thread_id GetThreadId() {
    return syscall(__NR_gettid);
  #elif defined(_WIN32)
    return GetCurrentThreadId();
@@ -39,7 +43,11 @@
 +  return pthread_getthreadid_np();
 +#elif defined(__NetBSD__)
 +  return _lwp_self();
-+#else // OpenBSD, Solaris
++#elif defined(__OpenBSD__)
++  return getthrid();
++#elif defined(__sun)
++  return thr_self();
++#else // fallback
 +  return (intptr_t) pthread_self();
  #endif
  }

Modified: head/devel/android-tools-simpleperf/files/patch-base_logging.cpp
==============================================================================
--- head/devel/android-tools-simpleperf/files/patch-base_logging.cpp	Wed Jul 10 01:16:13 2019	(r506329)
+++ head/devel/android-tools-simpleperf/files/patch-base_logging.cpp	Wed Jul 10 01:16:24 2019	(r506330)
@@ -18,7 +18,7 @@
  #include <iostream>
  #include <limits>
  #include <sstream>
-@@ -71,6 +72,12 @@
+@@ -71,6 +72,16 @@
  #include <unistd.h>
  #elif defined(_WIN32)
  #include <windows.h>
@@ -26,20 +26,28 @@
 +#include <pthread_np.h>
 +#elif defined(__NetBSD__)
 +#include <lwp.h>
-+#else
++#elif defined(__OpenBSD__)
++#include <unistd.h>
++#elif defined(__sun)
++#include <thread.h>
++#else // fallback
 +#include <stdint.h>
  #endif
  
  #if defined(_WIN32)
-@@ -88,6 +97,12 @@ static thread_id GetThreadId() {
+@@ -88,6 +97,16 @@ static thread_id GetThreadId() {
    return syscall(__NR_gettid);
  #elif defined(_WIN32)
    return GetCurrentThreadId();
-+#elif defined(__NetBSD__)
-+  return _lwp_self();
 +#elif defined(__DragonFly__) || defined(__FreeBSD__)
 +  return pthread_getthreadid_np();
-+#else
++#elif defined(__NetBSD__)
++  return _lwp_self();
++#elif defined(__OpenBSD__)
++  return getthrid();
++#elif defined(__sun)
++  return thr_self();
++#else // fallback
 +  return (intptr_t) pthread_self();
  #endif
  }

Modified: head/multimedia/gmmlib/files/patch-thread-id
==============================================================================
--- head/multimedia/gmmlib/files/patch-thread-id	Wed Jul 10 01:16:13 2019	(r506329)
+++ head/multimedia/gmmlib/files/patch-thread-id	Wed Jul 10 01:16:24 2019	(r506330)
@@ -2,7 +2,7 @@ Add more BSDs and update to modern way to get thread I
 
 --- Source/GmmLib/Utility/GmmLog/spdlog/details/os.h.orig	2018-09-28 18:59:39 UTC
 +++ Source/GmmLib/Utility/GmmLog/spdlog/details/os.h
-@@ -39,9 +39,13 @@
+@@ -39,9 +39,16 @@
  #include <unistd.h>
  #include <chrono>
  
@@ -15,10 +15,13 @@ Add more BSDs and update to modern way to get thread I
 +#elif defined(__NetBSD__)
 +#include <lwp.h>         // for _lwp_self
 +
++#elif defined(__sun)
++#include <thread.h>      // for thr_self
++
  #else
  #include <thread>
  
-@@ -302,10 +308,10 @@ inline size_t thread_id()
+@@ -302,10 +308,14 @@ inline size_t thread_id()
  #  define SYS_gettid __NR_gettid
  # endif
      return  static_cast<size_t>(syscall(SYS_gettid));
@@ -30,6 +33,10 @@ Add more BSDs and update to modern way to get thread I
 +    return static_cast<size_t>(pthread_getthreadid_np());
 +#elif defined(__NetBSD__)
 +    return static_cast<size_t>(_lwp_self());
++#elif defined(__OpenBSD__)
++    return getthrid();
++#elif defined(__sun)
++    return thr_self();
  #else //Default to standard C++11 (OSX and other Unix)
      return static_cast<size_t>(std::hash<std::thread::id>()(std::this_thread::get_id()));
  #endif

Modified: head/multimedia/libva-intel-media-driver/files/patch-thread-id
==============================================================================
--- head/multimedia/libva-intel-media-driver/files/patch-thread-id	Wed Jul 10 01:16:13 2019	(r506329)
+++ head/multimedia/libva-intel-media-driver/files/patch-thread-id	Wed Jul 10 01:16:24 2019	(r506330)
@@ -15,7 +15,7 @@ media_driver/linux/common/cm/cm_innerdef_os.h:98:37: n
 
 --- media_driver/linux/common/cm/cm_innerdef_os.h.orig	2018-10-01 21:39:52 UTC
 +++ media_driver/linux/common/cm/cm_innerdef_os.h
-@@ -35,8 +35,16 @@
+@@ -35,8 +35,18 @@
  
  #include "mos_os.h"
  #include "media_libva_common.h"
@@ -26,13 +26,15 @@ media_driver/linux/common/cm/cm_innerdef_os.h:98:37: n
 +#include <pthread_np.h>
 +#elif defined(__NetBSD__)
 +#include <lwp.h>
-+#else // OpenBSD, Solaris
++#elif defined(__sun)
++#include <thread.h>
++#else // fallback
 +#include <stdint.h>
 +#endif
  #include <unistd.h>
  
  //Require DRM VMAP patch,
-@@ -95,5 +103,13 @@ inline void GetLocalTime(PSYSTEMTIME psystime)
+@@ -95,5 +103,17 @@ inline void GetLocalTime(PSYSTEMTIME psystime)
  #endif
  
  #define CmGetCurProcessId() getpid()
@@ -42,7 +44,11 @@ media_driver/linux/common/cm/cm_innerdef_os.h:98:37: n
 +#define CmGetCurThreadId()  pthread_getthreadid_np()
 +#elif defined(__NetBSD__)
 +#define CmGetCurThreadId()  _lwp_self()
-+#else // OpenBSD, Solaris
++#elif defined(__OpenBSD__)
++#define CmGetCurThreadId()  getthrid()
++#elif defined(__sun)
++#define CmGetCurThreadId()  thr_self()
++#else // fallback
 +#define CmGetCurThreadId()  (uintptr_t)pthread_self()
 +#endif
  

Modified: head/multimedia/libva/files/patch-va_va__trace.c
==============================================================================
--- head/multimedia/libva/files/patch-va_va__trace.c	Wed Jul 10 01:16:13 2019	(r506329)
+++ head/multimedia/libva/files/patch-va_va__trace.c	Wed Jul 10 01:16:24 2019	(r506330)
@@ -2,7 +2,7 @@
 
 --- va/va_trace.c.orig	2019-07-05 13:14:31 UTC
 +++ va/va_trace.c
-@@ -48,12 +48,36 @@
+@@ -48,12 +48,42 @@
  #include <unistd.h>
  #include <sys/types.h>
  #include <sys/stat.h>
@@ -18,7 +18,9 @@
 +#include <pthread_np.h>
 +#elif defined(__NetBSD__)
 +#include <lwp.h>
-+#else // OpenBSD, Solaris
++#elif defined(__sun)
++#include <thread.h>
++#else // fallback
 +#include <stdint.h>
 +#endif
 +
@@ -31,7 +33,11 @@
 +  return pthread_getthreadid_np();
 +#elif defined(__NetBSD__)
 +  return _lwp_self();
-+#else // OpenBSD, Solaris
++#elif defined(__OpenBSD__)
++  return getthrid();
++#elif defined(__sun)
++  return thr_self();
++#else // fallback
 +  return (intptr_t) pthread_self();
 +#endif
 +}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907100116.x6A1GP5w002995>