Skip to content

Commit d4e2cdc

Browse files
pythongh-125434: Fix building on OpenBSD (pythonGH-132393)
pthread_get_name_np is defined in pthread_np.h.
1 parent a81232c commit d4e2cdc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Python/traceback.c

+11
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,17 @@ _Py_DumpTraceback(int fd, PyThreadState *tstate)
10391039
dump_traceback(fd, tstate, 1);
10401040
}
10411041

1042+
#if defined(HAVE_PTHREAD_GETNAME_NP) || defined(HAVE_PTHREAD_GET_NAME_NP)
1043+
# if defined(__OpenBSD__)
1044+
/* pthread_*_np functions, especially pthread_{get,set}_name_np().
1045+
pthread_np.h exists on both OpenBSD and FreeBSD but the latter declares
1046+
pthread_getname_np() and pthread_setname_np() in pthread.h as long as
1047+
__BSD_VISIBLE remains set.
1048+
*/
1049+
# include <pthread_np.h>
1050+
# endif
1051+
#endif
1052+
10421053
/* Write the thread identifier into the file 'fd': "Current thread 0xHHHH:\" if
10431054
is_current is true, "Thread 0xHHHH:\n" otherwise.
10441055

0 commit comments

Comments
 (0)