* bug#39363: emacs-git version: pthread_setname_np on NetBSD @ 2020-01-30 23:02 Thomas Klausner 2020-01-31 7:48 ` Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Thomas Klausner @ 2020-01-30 23:02 UTC (permalink / raw) To: 39363 [-- Attachment #1: Type: text/plain, Size: 493 bytes --] 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 [-- Attachment #2: patch-src_systhread.c --] [-- Type: text/plain, Size: 450 bytes --] $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 } ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#39363: emacs-git version: pthread_setname_np on NetBSD 2020-01-30 23:02 bug#39363: emacs-git version: pthread_setname_np on NetBSD Thomas Klausner @ 2020-01-31 7:48 ` Eli Zaretskii 2020-01-31 9:02 ` Robert Pluim 0 siblings, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2020-01-31 7:48 UTC (permalink / raw) To: Thomas Klausner; +Cc: 39363 > Date: Fri, 31 Jan 2020 00:02:13 +0100 > From: Thomas Klausner <wiz@NetBSD.org> > > 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__. I think we want instead to modify the configure-time test to include the possibility of 3-argument pthread_setname_np. Thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#39363: emacs-git version: pthread_setname_np on NetBSD 2020-01-31 7:48 ` Eli Zaretskii @ 2020-01-31 9:02 ` Robert Pluim 2020-01-31 17:09 ` Thomas Klausner 0 siblings, 1 reply; 7+ messages in thread From: Robert Pluim @ 2020-01-31 9:02 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 39363, Thomas Klausner >>>>> On Fri, 31 Jan 2020 09:48:13 +0200, Eli Zaretskii <eliz@gnu.org> said: >> Date: Fri, 31 Jan 2020 00:02:13 +0100 >> From: Thomas Klausner <wiz@NetBSD.org> >> >> 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__. Eli> I think we want instead to modify the configure-time test to include Eli> the possibility of 3-argument pthread_setname_np. Untested patch (I donʼt have any NetBSD machines). diff --git a/configure.ac b/configure.ac index f604acb694..1d922d9c02 100644 --- a/configure.ac +++ b/configure.ac @@ -4192,6 +4192,21 @@ AC_DEFUN AC_DEFINE( HAVE_PTHREAD_SETNAME_NP_1ARG, 1, [Define to 1 if pthread_setname_np takes a single argument.]) + else + AC_CACHE_CHECK( + [whether pthread_setname_np takes three arguments], + [emacs_cv_pthread_setname_np_3arg], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <pthread.h>]], + [[pthread_setname_np (0, "%s", "a");]])], + [emacs_cv_pthread_setname_np_3arg=yes], + [emacs_cv_pthread_setname_np_3arg=no])]) + if test "$emacs_cv_pthread_setname_np_3arg" = "yes"; then + AC_DEFINE( + HAVE_PTHREAD_SETNAME_NP_3ARG, 1, + [Define to 1 if pthread_setname_np takes three arguments.]) + fi fi fi diff --git a/src/systhread.c b/src/systhread.c index c649ae853a..0d600d6895 100644 --- a/src/systhread.c +++ b/src/systhread.c @@ -214,11 +214,13 @@ #define TASK_COMM_LEN 16 char p_name[TASK_COMM_LEN]; strncpy (p_name, name, TASK_COMM_LEN - 1); p_name[TASK_COMM_LEN - 1] = '\0'; - #ifdef HAVE_PTHREAD_SETNAME_NP_1ARG +# ifdef HAVE_PTHREAD_SETNAME_NP_1ARG pthread_setname_np (p_name); - #else +# elif defined HAVE_PTHREAD_SETNAME_NP_3ARG + pthread_setname_np (pthread_self (), "%s", p_name); +# else pthread_setname_np (pthread_self (), p_name); - #endif +# endif #endif } ^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#39363: emacs-git version: pthread_setname_np on NetBSD 2020-01-31 9:02 ` Robert Pluim @ 2020-01-31 17:09 ` Thomas Klausner 2020-02-03 11:37 ` Robert Pluim 0 siblings, 1 reply; 7+ messages in thread From: Thomas Klausner @ 2020-01-31 17:09 UTC (permalink / raw) To: Robert Pluim; +Cc: 39363 On Fri, Jan 31, 2020 at 10:02:50AM +0100, Robert Pluim wrote: > Eli> I think we want instead to modify the configure-time test to include > Eli> the possibility of 3-argument pthread_setname_np. > > Untested patch (I donʼt have any NetBSD machines). Works for me. Thank you! Thomas ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#39363: emacs-git version: pthread_setname_np on NetBSD 2020-01-31 17:09 ` Thomas Klausner @ 2020-02-03 11:37 ` Robert Pluim 2020-02-03 15:35 ` Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Robert Pluim @ 2020-02-03 11:37 UTC (permalink / raw) To: Thomas Klausner; +Cc: 39363 >>>>> On Mon, 03 Feb 2020 10:38:38 +0100, Robert Pluim <rpluim@gmail.com> said: >>>>> On Fri, 31 Jan 2020 18:09:57 +0100, Thomas Klausner <wiz@NetBSD.org> said: Thomas> On Fri, Jan 31, 2020 at 10:02:50AM +0100, Robert Pluim wrote: Eli> I think we want instead to modify the configure-time test to include Eli> the possibility of 3-argument pthread_setname_np. >>> >>> Untested patch (I donʼt have any NetBSD machines). Thomas> Works for me. Thank you! Thanks for testing. Eli, emacs-27 I presume? Robert ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#39363: emacs-git version: pthread_setname_np on NetBSD 2020-02-03 11:37 ` Robert Pluim @ 2020-02-03 15:35 ` Eli Zaretskii 2020-02-03 15:41 ` Robert Pluim 0 siblings, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2020-02-03 15:35 UTC (permalink / raw) To: Robert Pluim; +Cc: 39363, wiz > From: Robert Pluim <rpluim@gmail.com> > Date: Mon, 03 Feb 2020 12:37:02 +0100 > Cc: 39363@debbugs.gnu.org > > >>> Untested patch (I donʼt have any NetBSD machines). > > Thomas> Works for me. Thank you! > > Thanks for testing. Eli, emacs-27 I presume? Yes, thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#39363: emacs-git version: pthread_setname_np on NetBSD 2020-02-03 15:35 ` Eli Zaretskii @ 2020-02-03 15:41 ` Robert Pluim 0 siblings, 0 replies; 7+ messages in thread From: Robert Pluim @ 2020-02-03 15:41 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 39363-done, wiz >>>>> On Mon, 03 Feb 2020 17:35:18 +0200, Eli Zaretskii <eliz@gnu.org> said: >> From: Robert Pluim <rpluim@gmail.com> >> Date: Mon, 03 Feb 2020 12:37:02 +0100 >> Cc: 39363@debbugs.gnu.org >> >> >>> 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-02-03 15:41 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-01-30 23:02 bug#39363: emacs-git version: pthread_setname_np on NetBSD Thomas Klausner 2020-01-31 7:48 ` Eli Zaretskii 2020-01-31 9:02 ` Robert Pluim 2020-01-31 17:09 ` Thomas Klausner 2020-02-03 11:37 ` Robert Pluim 2020-02-03 15:35 ` Eli Zaretskii 2020-02-03 15:41 ` Robert Pluim
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).