Undeclared use of identifier 'pthread_getname_np' when building under OpenBSD/amd64 7.1-stable
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 280
- Avg merge
- 7m
- Merged PRs (30d)
- 4
Description
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](https://man.openbsd.org/OpenBSD-7.1/pthread_get_name_np) 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()`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.