com php-src: JIT register dump, fix BSD build.: ext/opcache/jit /zend_jit_perf_dump.c

From: Date: Thu, 04 Apr 2019 22:51:59 +0000
Subject: com php-src: JIT register dump, fix BSD build.: ext/opcache/jit /zend_jit_perf_dump.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-105526@lists.php.net to get a copy of this message
Commit: 5247a0bc6662582b1257738833fab06b230df01e Author: David Carlier <devnexen@gmail.com> Thu, 4 Apr 2019 22:54:19 +0100 Committer: Dmitry Stogov <dmitry@zend.com> Fri, 5 Apr 2019 01:51:59 +0300 Parents: df6709f480ce2d53b9944ffdf29e7a8ecad9d551 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5247a0bc6662582b1257738833fab06b230df01e Log: JIT register dump, fix BSD build. Changed paths: M ext/opcache/jit/zend_jit_perf_dump.c Diff: diff --git a/ext/opcache/jit/zend_jit_perf_dump.c b/ext/opcache/jit/zend_jit_perf_dump.c index eb76286..0a54b8c 100644 --- a/ext/opcache/jit/zend_jit_perf_dump.c +++ b/ext/opcache/jit/zend_jit_perf_dump.c @@ -24,6 +24,12 @@ #include <sys/mman.h> #include <sys/syscall.h> +#if defined(__FreeBSD__) +#include <sys/thr.h> +#elif defined(__NetBSD__) +#include <lwp.h> +#endif + #include "zend_elf.h" /* @@ -171,13 +177,25 @@ 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; +#if defined(__linux__) + thread_id = syscall(SYS_gettid); +#elif defined(__FreeBSD__) + long tid; + thr_self(&tid); + thread_id = (uint32_t)tid; +#elif defined(__OpenBSD__) + thread_id = getthrid(); +#elif defined(__NetBSD__) + thread_id = _lwp_self(); +#endif memset(&rec, 0, sizeof(rec)); rec.hdr.event = ZEND_PERF_JITDUMP_RECORD_LOAD; rec.hdr.size = sizeof(rec) + len + 1 + size; rec.hdr.time_stamp = zend_perf_timestamp(); rec.process_id = getpid(); - rec.thread_id = syscall(SYS_gettid); + rec.thread_id = thread_id; rec.vma = (uint64_t)(uintptr_t)start; rec.code_address = (uint64_t)(uintptr_t)start; rec.code_size = (uint64_t)size;

« previous php.cvs (#105526) next »