Fix crash on FreeBSD due to incorrect thr_self system call invocation (#285)

The correct signature is:
int thr_self(long *id);

It was called as thr_self() which caused memory corruption.
This commit is contained in:
yuri@FreeBSD 2024-08-15 20:38:07 -07:00 committed by GitHub
parent 793f24c48e
commit dcddfddf56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -113,7 +113,9 @@ INLINE void us_thread_get_name(char *name) { // Always required for logging
#if defined(__linux__)
const pid_t tid = syscall(SYS_gettid);
#elif defined(__FreeBSD__)
const pid_t tid = syscall(SYS_thr_self);
long id;
assert(!syscall(SYS_thr_self, &id));
const pid_t tid = id;
#elif defined(__OpenBSD__)
const pid_t tid = syscall(SYS_getthrid);
#elif defined(__NetBSD__)