Subject: bug#39363: closed (Re: bug#39363: emacs-git version: pthread_setname_np on NetBSD)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 03 Feb 2020 15:42:02 +0000

Your bug report

#39363: emacs-git version: pthread_setname_np on NetBSD

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
39363: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=39363
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#39363: emacs-git version: pthread_setname_np on NetBSD
From: Robert Pluim <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 03 Feb 2020 16:41:42 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

>>>>> On Mon, 03 Feb 2020 17:35:18 +0200, Eli Zaretskii <[email-masked]> said:

    >> From: Robert Pluim <[email-masked]>
    >> Date: Mon, 03 Feb 2020 12:37:02 +0100
    >> Cc: [email-masked]
    >> 
    >> >>> Untested patch (I donʼt have any NetBSD machines).
    >> 
    Thomas> Works for me. Thank you!
    >> 
    >> Thanks for testing. Eli, emacs-27 I presume?

    Eli> Yes, thanks.

Done. Closing bug.

Robert

Subject: emacs-git version: pthread_setname_np on NetBSD
From: Thomas Klausner <[email-masked]>
To: [email-masked]
Date: Fri, 31 Jan 2020 00:02:13 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

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
 }