On 24.01.2020 15:14, cbiesinger@chromium.org wrote: > From: Christian Biesinger > > 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 > > * thread-pool.c (set_thread_name): Add an overload for the NetBSD > version of pthread_setname_np. > Looks fine. > 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 > > /* 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 (name)); > +} > > ATTRIBUTE_UNUSED static void > set_thread_name (int (*set_name) (pthread_t, const char *), const char *name) >