Skip to content
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

Undeclared use of identifier 'pthread_getname_np' when building under OpenBSD/amd64 7.1-stable #225

Open
morgant opened this issue Aug 3, 2022 · 2 comments

Comments

@morgant
Copy link

morgant commented Aug 3, 2022

I'm working on updating the eduke32 port for OpenBSD to the latest release, which has since migrated to using loguru. When building under OpenBSD/amd64 7.1-stable, the following error is generated:

source/build/src/loguru.cpp:1152:5: error: use of undeclared identifier 'pthread_getname_np'; did you mean 'pthread_get_name_np'?
    pthread_getname_np(pthread_self(), buffer, length);
    ^~~~~~~~~~~~~
    pthread_get_name_np
/usr/include/pthread.np.h:50:6: note: 'pthread_get_name_np' declared here
void pthread_get_name_np(pthread_t, char *, size_t);

This is because OpenBSD's pthread_get_name_np() implementation does not alias pthread_getname_np like FreeBSD does.

Reviewing loguru.cpp, it appears that there are some attempts at OpenBSD support, including in the set_thread_name() & get_thread_name() implementations. However, while the set_thread_name() implementation seems to correctly use pthread_set_name_np() for FreeBSD & OpenBSD, unfortunately the get_thread_name() implementations doesn't have similar platform support and just tries to use pthread_getname_np().

@morgant
Copy link
Author

morgant commented Aug 3, 2022

I'll submit a patch, but I'm curious whether you prefer to have the logic defined in get_thread_name(), like it currently is in set_thread_name(), or would it be better to just appropriately alias pthread_getname_np & pthread_setname_np for OpenBSD with a macro? The latter seems cleaner to me at this time.

@seanm
Copy link

seanm commented Oct 11, 2023

I have a patch here if anyone can review/test: #245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants