summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2020-10-16 18:12:01 +0000
committerDmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>2020-10-16 13:37:22 -0700
commit0ed447df56fe14f9a83886c955365b6d13f972de (patch)
treecf9f1a645ab510999ad126c573e412a1502195b1
parent437d42611b50462e52352b61b0ac073a611cf071 (diff)
downloadlibva-0ed447df56fe14f9a83886c955365b6d13f972de.tar.gz
va/va_trace: ignore system gettid() on Linux
glibc could probably use `__GLIBC_PREREQ(2, 30)` but musl doesn't expose version to consumers. Instead of dancing around various libc always use local definition.
-rw-r--r--va/va_trace.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/va/va_trace.c b/va/va_trace.c
index f9847d2..5cb498d 100644
--- a/va/va_trace.c
+++ b/va/va_trace.c
@@ -63,8 +63,8 @@
#include <thread.h>
#endif
-#if !defined(__BIONIC__)
-static pid_t gettid()
+/* bionic, glibc >= 2.30, musl >= 1.3 have gettid(), so add va_ prefix */
+static pid_t va_gettid()
{
#if defined(__linux__)
return syscall(__NR_gettid);
@@ -81,7 +81,6 @@ static pid_t gettid()
return (intptr_t)pthread_self();
#endif
}
-#endif
/*
* Env. to debug some issue, e.g. the decode/encode issue in a video conference scenerio:
@@ -317,7 +316,7 @@ static void add_trace_config_info(
{
struct trace_config_info *pconfig_info;
int idx = 0;
- pid_t thd_id = gettid();
+ pid_t thd_id = va_gettid();
LOCK_RESOURCE(pva_trace);
@@ -695,7 +694,7 @@ static struct trace_log_file *start_tracing2log_file(
{
struct trace_log_files_manager *plog_files_mgr = NULL;
struct trace_log_file *plog_file = NULL;
- pid_t thd_id = gettid();
+ pid_t thd_id = va_gettid();
int i = 0;
LOCK_RESOURCE(pva_trace);
@@ -734,7 +733,7 @@ static void refresh_log_file(
struct trace_context *ptra_ctx)
{
struct trace_log_file *plog_file = NULL;
- pid_t thd_id = gettid();
+ pid_t thd_id = va_gettid();
int i = 0;
plog_file = ptra_ctx->plog_file;
@@ -1260,7 +1259,7 @@ static void internal_TraceUpdateContext (
{
struct trace_context *trace_ctx = NULL;
int i = 0, delete = 1;
- pid_t thd_id = gettid();
+ pid_t thd_id = va_gettid();
if(tra_ctx_idx >= MAX_TRACE_CTX_NUM)
return;