Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: cbiesinger@chromium.org
To: gdb-patches@sourceware.org
Cc: Christian Biesinger <cbiesinger@google.com>
Subject: [PATCH 1/3] Support the NetBSD version of pthread_setname_np
Date: Fri, 24 Jan 2020 14:15:00 -0000	[thread overview]
Message-ID: <20200124141458.171392-2-cbiesinger@chromium.org> (raw)
In-Reply-To: <20200124141458.171392-1-cbiesinger@chromium.org>

From: Christian Biesinger <cbiesinger@google.com>

On NetBSD, pthread_setname_np takes a printf-style format string plus
one argument:
https://netbsd.gw.com/cgi-bin/man-cgi?pthread_setname_np++NetBSD-current

This patch makes thread-pool.c handle that.

gdbsupport/ChangeLog:

2020-01-24  Christian Biesinger  <cbiesinger@google.com>

	* thread-pool.c (set_thread_name): Add an overload for the NetBSD
	version of pthread_setname_np.

Change-Id: I61e664a813eaa7f52b6811b1a43e08ac3082d8ef
---
 gdbsupport/thread-pool.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gdbsupport/thread-pool.c b/gdbsupport/thread-pool.c
index fc83ff765f..be9ca22682 100644
--- a/gdbsupport/thread-pool.c
+++ b/gdbsupport/thread-pool.c
@@ -40,8 +40,16 @@
 #include <pthread.h>
 
 /* Handle platform discrepancies in pthread_setname_np: macOS uses a
-   single-argument form, while Linux uses a two-argument form.  This
-   wrapper handles the difference.  */
+   single-argument form, while Linux uses a two-argument form.  NetBSD
+   takes a printf-style format and an argument.  This wrapper handles the
+   difference.  */
+
+ATTRIBUTE_UNUSED static void
+set_thread_name (int (*set_name) (pthread_t, const char *, void *),
+				  const char *name)
+{
+  set_name (pthread_self (), "%s", const_cast<char *> (name));
+}
 
 ATTRIBUTE_UNUSED static void
 set_thread_name (int (*set_name) (pthread_t, const char *), const char *name)
-- 
2.25.0.341.g760bfbb309-goog


  reply	other threads:[~2020-01-24 14:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24 14:15 [PATCH 0/3] Fix some ARM NetBSD compile errors cbiesinger
2020-01-24 14:15 ` cbiesinger [this message]
2020-01-24 14:59   ` [PATCH 1/3] Support the NetBSD version of pthread_setname_np Kamil Rytarowski
2020-01-24 15:04   ` Tom Tromey
2020-01-24 14:15 ` [PATCH 3/3] Make the class name in the definition match the declaration cbiesinger
2020-01-24 14:54   ` Kamil Rytarowski
2020-01-24 15:06   ` Tom Tromey
2020-01-24 15:49     ` Christian Biesinger via gdb-patches
2020-01-24 14:18 ` [PATCH 2/3] Define _KMEMUSER in arm-nbsd-nat.c cbiesinger
2020-01-24 14:22   ` [PATCH 2/3 v2] " cbiesinger
2020-01-24 14:32     ` Kamil Rytarowski
2020-01-24 14:34       ` Christian Biesinger via gdb-patches
2020-01-24 14:36         ` [PATCH v3 2/3] Define _KERNTYPES " cbiesinger
2020-01-24 15:04           ` Tom Tromey
2020-01-24 14:58       ` [PATCH 2/3 v2] Define _KMEMUSER " Christian Biesinger via gdb-patches
2020-01-24 15:36         ` Kamil Rytarowski
2020-01-24 15:37           ` Christian Biesinger via gdb-patches
2020-01-24 15:49             ` Kamil Rytarowski
2020-01-24 16:25               ` Christian Biesinger via gdb-patches
2020-01-24 16:45                 ` Kamil Rytarowski
2020-01-27 21:28                   ` Christian Biesinger via gdb-patches
2020-02-05 18:02                     ` Christian Biesinger via gdb-patches
2020-02-06 13:25                       ` Kamil Rytarowski
2020-02-06 13:19                     ` Kamil Rytarowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200124141458.171392-2-cbiesinger@chromium.org \
    --to=cbiesinger@chromium.org \
    --cc=cbiesinger@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox