From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: [PATCH] net/failsafe: fix FreeBSD build Date: Tue, 13 Feb 2018 22:33:12 +0100 Message-ID: <20180213213312.22225-1-thomas@monjalon.net> Cc: dev@dpdk.org, gaetan.rivet@6wind.com To: matan@mellanox.com Return-path: Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id E21751B321 for ; Tue, 13 Feb 2018 22:33:47 +0100 (CET) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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. The debug printing of the thread id is restricted to Linux only. Fixes: 655fcd68c7d2 ("net/failsafe: fix hotplug races") Signed-off-by: Thomas Monjalon --- drivers/net/failsafe/failsafe_private.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 5b84db905..86ade029f 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -374,8 +374,10 @@ fs_lock(struct rte_eth_dev *dev, unsigned int is_alarm) return ret; } } +#ifdef RTE_EXEC_ENV_LINUXAPP DEBUG("Hot-plug mutex was locked by thread %lu%s", pthread_self(), PRIV(dev)->alarm_lock ? " by the hot-plug alarm" : ""); +#endif return ret; } @@ -387,7 +389,6 @@ static inline void fs_unlock(struct rte_eth_dev *dev, unsigned int is_alarm) { int ret; - unsigned int prev_alarm_lock = PRIV(dev)->alarm_lock; if (is_alarm) { RTE_ASSERT(PRIV(dev)->alarm_lock == 1); @@ -396,10 +397,14 @@ fs_unlock(struct rte_eth_dev *dev, unsigned int is_alarm) ret = pthread_mutex_unlock(&PRIV(dev)->hotplug_mutex); if (ret) ERROR("Cannot unlock hot-plug mutex(%s)", strerror(ret)); - else +#ifdef RTE_EXEC_ENV_LINUXAPP + else { + unsigned int prev_alarm_lock = PRIV(dev)->alarm_lock; DEBUG("Hot-plug mutex was unlocked by thread %lu%s", pthread_self(), prev_alarm_lock ? " by the hot-plug alarm" : ""); + } +#endif } /* -- 2.15.1