From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 84CE545BC3; Thu, 24 Oct 2024 21:08:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F9A043555; Thu, 24 Oct 2024 21:08:37 +0200 (CEST) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mails.dpdk.org (Postfix) with ESMTP id 4DD0343562 for ; Thu, 24 Oct 2024 21:08:32 +0200 (CEST) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-20e576dbc42so12165215ad.0 for ; Thu, 24 Oct 2024 12:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1729796911; x=1730401711; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=d2gKIRspsGmCSyh+WbjwnWeQlIoXdZpkOz9z8tI5ISg=; b=e7RmqYax0lzZqTNCb2WNuqfs/1qaltCqJd2NaLWp1IW6q7A3vpUQDsRAFKXkgQsoQv OYXl/TFIayanqftOVSwBlvxjZDU8Dozb/uHX8D9CJ0pA/EdAeSc5/kiLMHpnEz8k6J9P 3sOvBSbvdjRFCTSGHIbGBuus5unFg/I+REgUsrZDg9oHqAewG16pTpNqFe9QK1wLTaMe JcKxfsH8DJew1fg1XhGMm0ning0r0gaDZBT4tuFwuEPcXaREpZbA00iZISiDUF16ywDw TEQo8GXy6S4iSftRHkAUM8B/6sFSyASpTxCVFdr8vd/ArbZCzDsOLFX0sArN5XhvRKhj kC4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729796911; x=1730401711; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d2gKIRspsGmCSyh+WbjwnWeQlIoXdZpkOz9z8tI5ISg=; b=J5vQK7VY1rFmWYOBp89GUYHHrFF4jVxASfi+JC84mn3pNGBuhci+Elr6eRiuqFWRTL QGpxkFRm6E2PUZ/3jnLDRsYJsc0fmmrN8qi9xWxnaODoXpb27Atsckrr9frjeVLgxKiN 6Q+sc2urmH2x3E5YYQDhx9pPwOWRmYykt3gWp/Wk9+w/v+7Op0yEIo868+bWFLyMB3c+ +npwMlmS9gt1TJbTuAcn0NicQhhD0C9ZK6ZfxoZ93ITmlfT3OoUMgY6hd2iH3S3mQcuH 1dtynyBJBarLnHsEO1dxGoQr7I2Ewx1b7TCBXO+yGHPjBSHyUjWohaxOIQaXCrkzuYO/ Vn6g== X-Gm-Message-State: AOJu0YxYl5EN1TwefgulvfQ5JpFsw9FUhu+1vcxjhsaaDIdekUCHBIYt 5Jvrs/6BJ3s/iaMkn3L+yptD7GysTOYkQzphqD8HTj6X7kcf28JYuFMN+I9l+4u4zGuSlpcKB5U b X-Google-Smtp-Source: AGHT+IH5RohrVGVTdYk5IZqNp88sKijEjg4zLmIY9FR+7tjRdheoyqZGyDsjffJEL4ixUKlaiU8q8Q== X-Received: by 2002:a17:902:d481:b0:20c:ecd8:d0af with SMTP id d9443c01a7336-20fa9de9252mr88702475ad.9.1729796911404; Thu, 24 Oct 2024 12:08:31 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20e7f0f364bsm75535385ad.264.2024.10.24.12.08.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 12:08:31 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Tyler Retzlaff , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Bruce Richardson , Chengwen Feng , Dmitry Kozlyuk Subject: [PATCH v28 03/13] windows: update os shim Date: Thu, 24 Oct 2024 12:02:49 -0700 Message-ID: <20241024190818.172863-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241024190818.172863-1-stephen@networkplumber.org> References: <20200814173441.23086-1-stephen@networkplumber.org> <20241024190818.172863-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Windows does not have localtime_r but it does have a similar function that can be used instead. Use rte_os_shim.h in lib/log instead of redefine of strdup. Signed-off-by: Stephen Hemminger Acked-by: Tyler Retzlaff Acked-by: Morten Brørup Acked-by: Bruce Richardson Acked-by: Chengwen Feng --- lib/eal/windows/include/rte_os_shim.h | 10 ++++++++++ lib/log/log.c | 7 +++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/eal/windows/include/rte_os_shim.h b/lib/eal/windows/include/rte_os_shim.h index eda8113662..665c9ac93b 100644 --- a/lib/eal/windows/include/rte_os_shim.h +++ b/lib/eal/windows/include/rte_os_shim.h @@ -110,4 +110,14 @@ rte_clock_gettime(clockid_t clock_id, struct timespec *tp) } #define clock_gettime(clock_id, tp) rte_clock_gettime(clock_id, tp) +static inline struct tm * +rte_localtime_r(const time_t *timep, struct tm *result) +{ + if (localtime_s(result, timep) == 0) + return result; + else + return NULL; +} +#define localtime_r(timep, result) rte_localtime_r(timep, result) + #endif /* _RTE_OS_SHIM_ */ diff --git a/lib/log/log.c b/lib/log/log.c index 255f757d94..7416c82b34 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -14,13 +14,12 @@ #include #include - -#include "log_internal.h" - #ifdef RTE_EXEC_ENV_WINDOWS -#define strdup _strdup +#include #endif +#include "log_internal.h" + struct rte_log_dynamic_type { const char *name; uint32_t loglevel; -- 2.45.2