Skip to content

Fix failing compilation on OpenBSD #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions loguru.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,11 @@ namespace loguru
// Ask the OS about the thread name.
// This is what we *want* to do on all platforms, but
// only some platforms support it (currently).
pthread_getname_np(pthread_self(), buffer, length);
#ifdef __OpenBSD__
pthread_get_name_np(pthread_self(), buffer, length);
#else
pthread_getname_np(pthread_self(), buffer, length);
#endif
#elif LOGURU_WINTHREADS
snprintf(buffer, static_cast<size_t>(length), "%s", thread_name_buffer());
#else
Expand All @@ -1101,7 +1105,11 @@ namespace loguru
long thread_id;
(void)thr_self(&thread_id);
#elif LOGURU_PTHREADS
uint64_t thread_id = pthread_self();
#ifdef __OpenBSD__
uintptr_t thread_id = reinterpret_cast<uintptr_t>(pthread_self());
#else
uint64_t thread_id = pthread_self();
#endif
#else
// This ID does not correllate to anything we can get from the OS,
// so this is the worst way to get the ID.
Expand Down