Subject: emacs-git version: pthread_setname_np on NetBSD

From: Thomas Klausner <[email-masked]>
Date: Fri, 31 Jan 2020 00:02:13 +0100

Hi!

Recently, emacs from git stopped compiling on NetBSD because it
started using pthread_setname_np. AFAIK, there is no commonly agreed
upon standard for this function, and NetBSD's uses three arguments, see
https://netbsd.gw.com/cgi-bin/man-cgi?pthread_setname_np++NetBSD-current

The attached patch makes emacs compile again (on NetBSD-9.99.43/amd64)
but configure should probably be taught to look for that version of
pthread_setname_np instead of the #ifdef __NetBSD__.

Thanks,
 Thomas
$NetBSD$

Adapt pthread_setname_np calling convention for NetBSD.

--- src/systhread.c.orig	2020-01-30 22:42:52.049505198 +0000
+++ src/systhread.c
@@ -217,7 +217,11 @@ sys_thread_set_name (const char *name)
  #ifdef HAVE_PTHREAD_SETNAME_NP_1ARG
   pthread_setname_np (p_name);
  #else
+  #ifdef __NetBSD__
+  pthread_setname_np (pthread_self (), "%s", p_name);
+  #else
   pthread_setname_np (pthread_self (), p_name);
+  #endif
  #endif
 #endif
 }