From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#39363: emacs-git version: pthread_setname_np on NetBSD Date: Fri, 31 Jan 2020 10:02:50 +0100 Message-ID: References: <20200130230213.z5fkdsj2zjodhjrc@danbala> <83y2tokqwy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="62181"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39363@debbugs.gnu.org, Thomas Klausner To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 31 10:04:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ixSDk-000Fy3-Hc for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 31 Jan 2020 10:04:12 +0100 Original-Received: from localhost ([::1]:50192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixSDj-00049L-JC for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 31 Jan 2020 04:04:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56876) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixSDb-00049E-Lk for bug-gnu-emacs@gnu.org; Fri, 31 Jan 2020 04:04:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ixSDa-0006Zc-Az for bug-gnu-emacs@gnu.org; Fri, 31 Jan 2020 04:04:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58800) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ixSDa-0006ZO-6n for bug-gnu-emacs@gnu.org; Fri, 31 Jan 2020 04:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ixSDa-0000jD-3C for bug-gnu-emacs@gnu.org; Fri, 31 Jan 2020 04:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 31 Jan 2020 09:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39363 X-GNU-PR-Package: emacs Original-Received: via spool by 39363-submit@debbugs.gnu.org id=B39363.15804613842737 (code B ref 39363); Fri, 31 Jan 2020 09:04:02 +0000 Original-Received: (at 39363) by debbugs.gnu.org; 31 Jan 2020 09:03:04 +0000 Original-Received: from localhost ([127.0.0.1]:36540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ixSCd-0000i5-SR for submit@debbugs.gnu.org; Fri, 31 Jan 2020 04:03:04 -0500 Original-Received: from mail-wr1-f43.google.com ([209.85.221.43]:42987) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ixSCZ-0000hY-QX for 39363@debbugs.gnu.org; Fri, 31 Jan 2020 04:03:02 -0500 Original-Received: by mail-wr1-f43.google.com with SMTP id k11so7646012wrd.9 for <39363@debbugs.gnu.org>; Fri, 31 Jan 2020 01:02:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=au+olIBmgSBxKfPoOx2zDoPUXqGtvYBvkF/RfCi3SRA=; b=ZAW9ihUwKoBjeezryo9LjFjFFsaiFrarvST7XKjdWQdWUdDs1CcjkmgwIr/+6IyYtT MXMxpRtESGJgFkWjOwEobsu19sqDat13KZvLLt93XNqAkGlG+k8b6JYGmUG1HegFSWKH YXZaf80RQ73EkaWZg9TCNvOyR2GAwt7WFZ9z9TgQPEgnXRZcs1UZ1bn+fyNMYCLbyPEj oCEmLvSYobIjCRBTIDO+8heTF3fC3FihkQEHirVmAGOXtOlaoSOONtvT/K6q+wvDfbJg OfebZGhpIO/izYCUUyufZJGHkZKAtky1XNVdg773P2UTFBAzA2jpAwpmsIUgNgE+RH/q a8Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=au+olIBmgSBxKfPoOx2zDoPUXqGtvYBvkF/RfCi3SRA=; b=R4mz7f2cSnIMQUuRrtB959Q0u92AsX7WNcdBbdeb0sRZff+21Amia+FF6AQH52Jnhp IiiN7m61C5VgERN+cW5btmNnzg+Y0I8e4I0+6boU3eCf+GU9HpuSBHIQPGXt89OQjGz4 BfqklNaKU4vcEFHZ9yXJdcWMOThrALn52g4iZ+qMhic8M1YEH8gCkK27+atDOniEMcDE i9jtoYorYjl7nCd98FF0BPIp3C1WrB9syLbBJk/VfyjUJ1dENpse7PPTivPQwSbIs5Pe cK3YNknyvfMB8hUz9NdrBzKZnzM4oWRe8n4LSsTho13MN4XaM+MfLjJeb6L9TFh3ii4I pCrQ== X-Gm-Message-State: APjAAAUTfo54TnvbagwSCLGtDGxMnOVPo4oovjwY/G7v134/Slqbq8q9 XdmzewlrJRHUu8agKjbHx3TcR8uJ X-Google-Smtp-Source: APXvYqy7GCWg5RQHiOw2q3PZv5UvmE6h88v8dsB5HSzDHpJYSRIZT8VHgKwfzbLA/uSaqvybCXeDQA== X-Received: by 2002:adf:9dc9:: with SMTP id q9mr10422178wre.286.1580461373585; Fri, 31 Jan 2020 01:02:53 -0800 (PST) Original-Received: from rpluim-mac ([2a01:e34:ecfc:a860:d0f5:4a4e:ebb:3f19]) by smtp.gmail.com with ESMTPSA id e22sm7887801wrc.13.2020.01.31.01.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2020 01:02:52 -0800 (PST) In-Reply-To: <83y2tokqwy.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 31 Jan 2020 09:48:13 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:175472 Archived-At: >>>>> On Fri, 31 Jan 2020 09:48:13 +0200, Eli Zaretskii said: >> Date: Fri, 31 Jan 2020 00:02:13 +0100 >> From: Thomas Klausner >>=20 >> 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-cur= rent >>=20 >> The attached patch makes emacs compile again (on NetBSD-9.99.43/amd6= 4) >> 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 inclu= de Eli> the possibility of 3-argument pthread_setname_np. Untested patch (I don=CA=BCt 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_setname_np (0, "%s", "a");]])], + [emacs_cv_pthread_setname_np_3arg=3Dyes], + [emacs_cv_pthread_setname_np_3arg=3Dno])]) + if test "$emacs_cv_pthread_setname_np_3arg" =3D "yes"; then + AC_DEFINE( + HAVE_PTHREAD_SETNAME_NP_3ARG, 1, + [Define to 1 if pthread_setname_np takes three arguments.]) + fi fi fi =20 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] =3D '\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 } =20