Source: libva Version: 2.9.0-1 Severity: important Tags: ftbfs, patch User: debian-h...@lists.debian.org debian-k...@lists.debian.org Usertags: hurd kfreebsd
Hello, libva fails to build due to usage of a linux-specific usage of syscall(__NR_gettid) in va/va_trace.c. The attached patch, va_va_trace.c.diff, replaces that call with pthread_self() for non- linux systems. Build-tested on GNU/Linux, GNU/Hurd and GNU/kFreeBSD. Thanks!
Index: libva-2.9.0/va/va_trace.c =================================================================== --- libva-2.9.0.orig/va/va_trace.c +++ libva-2.9.0/va/va_trace.c @@ -288,8 +288,13 @@ static void add_trace_config_info( { struct trace_config_info *pconfig_info; int idx = 0; - pid_t thd_id = syscall(__NR_gettid); + pid_t thd_id; +#ifdef __linux__ + thd_id = syscall(__NR_gettid); +#else + thd_id = pthread_self(); +#endif LOCK_RESOURCE(pva_trace); for (idx = 0;idx < MAX_TRACE_CTX_NUM;idx++) { @@ -666,8 +671,14 @@ static struct trace_log_file *start_trac { struct trace_log_files_manager *plog_files_mgr = NULL; struct trace_log_file *plog_file = NULL; - pid_t thd_id = syscall(__NR_gettid); int i = 0; + pid_t thd_id; + +#ifdef __linux__ + thd_id = syscall(__NR_gettid); +#else + thd_id = pthread_self(); +#endif LOCK_RESOURCE(pva_trace); @@ -705,8 +716,14 @@ static void refresh_log_file( struct trace_context *ptra_ctx) { struct trace_log_file *plog_file = NULL; - pid_t thd_id = syscall(__NR_gettid); int i = 0; + pid_t thd_id; + +#ifdef __linux__ + thd_id = syscall(__NR_gettid); +#else + thd_id = pthread_self(); +#endif plog_file = ptra_ctx->plog_file; if(plog_file && plog_file->thread_id != thd_id) { @@ -1231,7 +1248,13 @@ static void internal_TraceUpdateContext { struct trace_context *trace_ctx = NULL; int i = 0, delete = 1; - pid_t thd_id = syscall(__NR_gettid); + pid_t thd_id; + +#ifdef __linux__ + thd_id = syscall(__NR_gettid); +#else + thd_id = pthread_self(); +#endif if(tra_ctx_idx >= MAX_TRACE_CTX_NUM) return;