mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-12 02:23:43 +00:00
Issue #39: fixed missing gettid() syscall on *BSD
This commit is contained in:
@@ -102,7 +102,20 @@ INLINE void thread_get_name(char *name) { // Always required for logging
|
|||||||
# endif
|
# endif
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
#endif
|
#endif
|
||||||
assert(snprintf(name, MAX_THREAD_NAME, "tid=%d", (pid_t)syscall(SYS_gettid)) > 0);
|
#if defined(__linux__)
|
||||||
|
pid_t tid = syscall(SYS_gettid);
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
pid_t tid = syscall(SYS_thr_self);
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
|
pid_t tid = syscall(SYS_getthrid);
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
|
pid_t tid = syscall(SYS__lwp_self);
|
||||||
|
#elif defined(__DragonFly__)
|
||||||
|
pid_t tid = syscall(SYS_lwp_gettid);
|
||||||
|
#else
|
||||||
|
# error gettid() not implemented
|
||||||
|
#endif
|
||||||
|
assert(snprintf(name, MAX_THREAD_NAME, "tid=%d", tid) > 0);
|
||||||
#ifdef WITH_PTHREAD_NP
|
#ifdef WITH_PTHREAD_NP
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user