From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72727 invoked by alias); 24 Jan 2020 14:15:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 72429 invoked by uid 89); 24 Jan 2020 14:15:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1510, HContent-Transfer-Encoding:8bit X-HELO: mail-wr1-f68.google.com Received: from mail-wr1-f68.google.com (HELO mail-wr1-f68.google.com) (209.85.221.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 Jan 2020 14:15:18 +0000 Received: by mail-wr1-f68.google.com with SMTP id z7so2131785wrl.13 for ; Fri, 24 Jan 2020 06:15:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qculg+oiCKJ+1QxxO9CUxbjyr5mAWfTZkaJsH/aNGA8=; b=H1Vjpt/YVtJcn0lqA42P5YTax9N00gs1gjs+1sHyXSzvbw92LtxEIhNICt+CahGUFP FNad8K34KO0+PT+8uG9LrFFUoc06EmF9E6J/yUS7HpoMhoyJkebpaNMjNDKIzY94uP/n 9aINHIRX3M5DAlW3tpdcT63Uwvms/9DL8WJCI= Return-Path: Received: from cbiesinger.roam.corp.google.com (fanzine.igalia.com. [178.60.130.6]) by smtp.googlemail.com with ESMTPSA id t25sm6974515wmj.19.2020.01.24.06.15.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2020 06:15:15 -0800 (PST) From: cbiesinger@chromium.org To: gdb-patches@sourceware.org Cc: Christian Biesinger Subject: [PATCH 1/3] Support the NetBSD version of pthread_setname_np Date: Fri, 24 Jan 2020 14:15:00 -0000 Message-Id: <20200124141458.171392-2-cbiesinger@chromium.org> In-Reply-To: <20200124141458.171392-1-cbiesinger@chromium.org> References: <20200124141458.171392-1-cbiesinger@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SW-Source: 2020-01/txt/msg00788.txt.bz2 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. 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) -- 2.25.0.341.g760bfbb309-goog