gh-125434: Fix building on OpenBSD (GH-132393) · python/cpython@d4e2cdc

GitHub

Original file line numberDiff line numberDiff line change@@ -1039,6 +1039,17 @@ _Py_DumpTraceback(int fd, PyThreadState *tstate)

10391039dump_traceback(fd, tstate, 1);

10401040}

104110411042+#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