OSDN Git Service

NetBSD build fix
authorIvailo Monev <xakepa10@gmail.com>
Sat, 14 Nov 2020 15:57:19 +0000 (17:57 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Sat, 14 Nov 2020 15:57:19 +0000 (17:57 +0200)
apparently the signature of pthread_setname_np() is different than the one
documented in the Linux man page for it:
https://man7.org/linux/man-pages/man3/pthread_setname_np.3.html
https://man.netbsd.org/pthread_setname_np.3

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/core/thread/qthread_unix.cpp

index 3635e44..1099d0a 100644 (file)
@@ -209,6 +209,8 @@ void *QThreadPrivate::start(void *arg)
         objectName = thr->metaObject()->className();
 #if defined(QT_HAVE_PRCTL)
     ::prctl(PR_SET_NAME, (unsigned long)objectName.toLocal8Bit().constData(), 0, 0, 0);
+#elif defined(QT_HAVE_PTHREAD_SETNAME_NP) && defined(Q_OS_NETBSD)
+    pthread_setname_np(thr->d_func()->thread_id, objectName.toLocal8Bit().constData(), (char*)"%s");
 #elif defined(QT_HAVE_PTHREAD_SETNAME_NP)
     pthread_setname_np(thr->d_func()->thread_id, objectName.toLocal8Bit().constData());
 #endif