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 12DAF45B88; Fri, 25 Oct 2024 23:46:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 715414067D; Fri, 25 Oct 2024 23:46:46 +0200 (CEST) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by mails.dpdk.org (Postfix) with ESMTP id 2FE2E40667 for ; Fri, 25 Oct 2024 23:46:43 +0200 (CEST) Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2e2a999b287so1982509a91.0 for ; Fri, 25 Oct 2024 14:46:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1729892802; x=1730497602; 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=ssAdS1j8+6x8uo4J9ONzKrlzKRzU5SBLpATC+P3l8w9GAURfhiQ5auj8jrBzFk0f2I 0i/yAHrZOf4t6UdkvaoG4tBdjJowqniMLT1plcQy9iesPd3rSgK2Rnqfvp08oGB4BLVM /bAxae278j/aNO0D6c+lfYGqKunoou2GUWWEAx2YmWMgCttO6ooE2tQwU1t3ROve4q/w RgRvoEuu9PI/DUJO7/o2AI28notsmyJ6Caz2VYYVpB3Rl1Mad0MYmd55//6bUlxAe9Ss t69/FGhGf6wXkbIqxlNKTC21uvKAPhCUhAifdjsrSH2fFBYRg3CU2imtvXyaxtxbZVko yIvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729892802; x=1730497602; 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=AcLYnTX3nONJTPssLFo8lUKJN5fQO2462x9pMvliIiXoJJ4BBR3QImTvsi8ghk0HCv ghbZV6D4l5OGVqQOJ84NdKCTsMAl5cUbtfHAu56BXy/PNR8E3flgiHkr44TAbt2CqHb6 fySxZAoknsiqUfNxoKdAS4PQtOGJG2aDjwocZ8I9fbsSvKe7agklYDHRvl31FBS/yBR5 OkRLq1zleuJzPu2GW1fY802hFlcurGIcm9InUwmNo/2vfA3E07miyDtbOIt+z3++HPuh IdDAdYzl2Vpc1ZvFeOLC7eFHK/63IIO6N+ysHWp8JxTcwfR31Ea2LzOZ7UvbQE1i/aui 21Gg== X-Gm-Message-State: AOJu0YwQ6y//jlzNbWXyneNOs+K6GnkDz9GGAPSpOYnez1EYnzvMiF2p hCrZnJcr5mYmu89b61vI998/co+qcXnE9tbpc5+QXc6LFbtbBfAZW/baZ3oSqHavge5jU45zIhN G X-Google-Smtp-Source: AGHT+IFMinn8hUpAaCzX+PkxsiwlIVmlEE4tKX5PGF788fMb0PS+j8z0kckogvGZVUEpzxVem1nosA== X-Received: by 2002:a17:90b:4b0d:b0:2da:d766:1925 with SMTP id 98e67ed59e1d1-2e8f11b9e12mr886342a91.37.1729892802260; Fri, 25 Oct 2024 14:46:42 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e77e4c9c1bsm4049934a91.19.2024.10.25.14.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 14:46:41 -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 v29 03/13] windows: update os shim Date: Fri, 25 Oct 2024 14:45:08 -0700 Message-ID: <20241025214625.62876-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241025214625.62876-1-stephen@networkplumber.org> References: <20200814173441.23086-1-stephen@networkplumber.org> <20241025214625.62876-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