From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 7A6BD160 for ; Tue, 13 Feb 2018 23:13:37 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0351621564; Tue, 13 Feb 2018 17:13:37 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Tue, 13 Feb 2018 17:13:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=/O3Q06MbWbsIS6 EwmI5TlnUHeKWcMttEHR3RIKEqJb0=; b=Sd82r+7wk7oagQabXtg8SfJug65XDB 5agrNYKXPXES/EpT9Ppj+djUUXLjf/6QaRSea340QK6gRIkf4Y74bVi7erHpUjEJ sIHGlMZi8Ma12qkoFj09gNPeGjb3TK6Ho4j7e8TWzUr3i8y0Y6Pw2DzgDp6AQ/u3 kdHZBBGc821Uw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=/O3Q06MbWbsIS6EwmI5TlnUHeKWcMttEHR3RIKEqJb0=; b=AhsxsrI/ /WLXn9t6Q1+XLI1UN1SnCoc30PduA1IdTTwg0buZz/quay0tYVDh9vU9wWi2G/ry imf/i4QI3d3pzOjRwgKYM4J1vVmO5HZW8LNFDsWotksTjq+KWBa6dJf7U/HgQESq 0C6jx+6obVAaq99ooNlg/HKCdimAy2EayPdRrtJ/w6B75wt3Wg0/Y+ftdJF3U9Sx Tn3UlXeK9Oou1q/zPNgn/BIW1TIAMLC0rvZ11IkYAzOvg9Gw5Q9xVJewAjNhoURO SQw1OKj/uGBIuH1HXcKfqsfkTKfN/1d32FSn78ZRBzsOC5peUGm+ynBbLli42LqV Qoy0pa4sOWRsTw== X-ME-Sender: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 534F6246AC; Tue, 13 Feb 2018 17:13:36 -0500 (EST) From: Thomas Monjalon To: matan@mellanox.com Cc: dev@dpdk.org, gaetan.rivet@6wind.com Date: Tue, 13 Feb 2018 23:13:24 +0100 Message-Id: <20180213221324.24524-1-thomas@monjalon.net> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180213213312.22225-1-thomas@monjalon.net> References: <20180213213312.22225-1-thomas@monjalon.net> Subject: [dpdk-dev] [PATCH v2] net/failsafe: fix FreeBSD build X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 22:13:37 -0000 The type pthread_t is not portable because it is freely defined. On Linux, it is an unsigned long int which can be printed with %l. On FreeBSD, it is a pointer which can be printed with %p. That's why there was this error: drivers/net/failsafe/failsafe_private.h:377:53: error: format specifies type 'unsigned long' but the argument has type 'pthread_t' (aka 'struct pthread *') Fixes: 655fcd68c7d2 ("net/failsafe: fix hotplug races") Reported-by: Pablo de Lara Signed-off-by: Thomas Monjalon --- v2: adapt printing to BSD and Linux --- drivers/net/failsafe/failsafe_private.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 5b84db905..2d16ba4ca 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -318,6 +318,14 @@ extern int mac_from_arg; &((struct txq *)((s)->fs_dev->data->tx_queues[i]))->refcnt[(s)->sid] \ ) +#ifdef RTE_EXEC_ENV_BSDAPP +#define FS_THREADID_TYPE void* +#define FS_THREADID_FMT "p" +#else +#define FS_THREADID_TYPE unsigned long +#define FS_THREADID_FMT "lu" +#endif + #define LOG__(level, m, ...) \ RTE_LOG(level, PMD, "net_failsafe: " m "%c", __VA_ARGS__) #define LOG_(level, ...) LOG__(level, __VA_ARGS__, '\n') @@ -374,7 +382,8 @@ fs_lock(struct rte_eth_dev *dev, unsigned int is_alarm) return ret; } } - DEBUG("Hot-plug mutex was locked by thread %lu%s", pthread_self(), + DEBUG("Hot-plug mutex was locked by thread %" FS_THREADID_FMT "%s", + (FS_THREADID_TYPE)pthread_self(), PRIV(dev)->alarm_lock ? " by the hot-plug alarm" : ""); return ret; } @@ -397,8 +406,8 @@ fs_unlock(struct rte_eth_dev *dev, unsigned int is_alarm) if (ret) ERROR("Cannot unlock hot-plug mutex(%s)", strerror(ret)); else - DEBUG("Hot-plug mutex was unlocked by thread %lu%s", - pthread_self(), + DEBUG("Hot-plug mutex was unlocked by thread %" FS_THREADID_FMT "%s", + (FS_THREADID_TYPE)pthread_self(), prev_alarm_lock ? " by the hot-plug alarm" : ""); } -- 2.15.1