From: Nikita Popov Date: Thu, 13 Jun 2019 07:55:09 +0000 (+0200) Subject: Determine thread ID on macos X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=39034dbc67f2d74cc3e846189e7a440e771256c3;p=php Determine thread ID on macos Also initialize the variable to 0 -- I don't think we really care if this is not determine on some platform, but it should at least not be uninitialized. --- diff --git a/ext/opcache/jit/zend_jit_perf_dump.c b/ext/opcache/jit/zend_jit_perf_dump.c index d46c5b0091..d99c85a9a0 100644 --- a/ext/opcache/jit/zend_jit_perf_dump.c +++ b/ext/opcache/jit/zend_jit_perf_dump.c @@ -24,10 +24,12 @@ #include #include -#if defined(__FreeBSD__) -#include +#if defined(__darwin__) +# include +#elif defined(__FreeBSD__) +# include #elif defined(__NetBSD__) -#include +# include #endif #include "zend_elf.h" @@ -177,9 +179,13 @@ static void zend_jit_perf_jitdump_register(const char *name, void *start, size_t static uint64_t id = 1; zend_perf_jitdump_load_record rec; size_t len = strlen(name); - uint32_t thread_id; + uint32_t thread_id = 0; #if defined(__linux__) thread_id = syscall(SYS_gettid); +#elif defined(__darwin__) + uint64_t thread_id_u64; + pthread_threadid_np(NULL, &thread_id_u64); + thread_id = (uint32_t) thread_id_u64; #elif defined(__FreeBSD__) long tid; thr_self(&tid);