From 15a3bb4b8d2061c28683f30284d38a9b81350002 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 14 Feb 2019 18:48:18 +0530 Subject: [PATCH] Fix building on NetBSD Thanks to Thomas Klausner --- src/calibre/utils/speedup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/utils/speedup.c b/src/calibre/utils/speedup.c index bdad0a7c6d..1d3d5763db 100644 --- a/src/calibre/utils/speedup.c +++ b/src/calibre/utils/speedup.c @@ -502,6 +502,8 @@ extern int pthread_setname_np(const char *name); #elif defined(FREEBSD_SET_NAME) // Function has a different name on FreeBSD void pthread_set_name_np(pthread_t tid, const char *name); +#elif defined(__NetBSD__) +// pthread.h provides the symbol #else // Need _GNU_SOURCE for pthread_setname_np on linux and that causes other issues on systems with old glibc extern int pthread_setname_np(pthread_t, const char *name); @@ -526,6 +528,8 @@ set_thread_name(PyObject *self, PyObject *args) { #elif defined(FREEBSD_SET_NAME) pthread_set_name_np(pthread_self(), name); ret = 0; +#elif defined(__NetBSD__) + ret = pthread_setname_np(pthread_self(), "%s", name); #else ret = pthread_setname_np(pthread_self(), name); #endif