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 B6C9145BB9; Thu, 24 Oct 2024 05:20:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7F214336B; Thu, 24 Oct 2024 05:20:44 +0200 (CEST) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id 0DB514335A for ; Thu, 24 Oct 2024 05:20:40 +0200 (CEST) Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2e30db524c2so386391a91.1 for ; Wed, 23 Oct 2024 20:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1729740039; x=1730344839; 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=jfa85UzZmC8Wt4R4d17CUQahZE+Rgi4EHmraZ/kcAQXhelU0c9ZfHrTaDbfBJM5lAA I9td3WYYB9Ak+pcxj1UgW2C/Knq8WbpjincYxrVsbbh0BApJ4ZAZ+4OfRfUO/YO58oiv SZK1xPf8HMTaXUS4hdcREL00Vt7kLOa/SPAen0TUVKUHBgX45vVAezgn07VfNG6KudkX OIAfu4Kj5MoTlZhGQ/HDsDgzN5NFfTAvUOJwAjP4ChJL4aKPN4S9khqptYkdsCq2C1rU g6ERjL1KXStXax1js8s5DsGAkkUquiTVcU3tpwPGIY2eXTbd5tQC7OSU2x06MwdDaf8A ETbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729740039; x=1730344839; 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=bxi2GxkLxYNwYCQdZ99W9lb6z8UHUu7AqzpGd592tuFAwqVMvKwbC2ThAyl2WX/nyE Ra/gYaAtQhRyu3wfYmP6Tyqv8mMiNPIIrV4ShcPuFQecEpH3ZCMSu/nr3Sa5h/XfnKrf WdEbbNHk0PFuOMK3h6zPBRyQmQR33JZnHJGJlu7+XgvRWwMkCGrWqrNcAg5O5INkYLnO /YChIBQIuKhKeSpG4R+LoK3SOO+kYuBBInwZ+A0GB0Eq6veHaDThA99KIrGFVS3ofPHs MqWiX0LAgojNDJIRvR/qBpmyQeljC6VLYPsjOcuikAOWXm/Sj0XHHQC6gz0GsVuaV51P afcg== X-Gm-Message-State: AOJu0YwpVYZnUFln6pEwz14zo6LLqh768JVjBD8+0g6WJgERaxyv/3Ix x5dcNTRh24/ayyLnfYxnvUvoOFBMVJDY7dyO0UxUtnZFmqwOJj8ZV0LFrdEZdbAy29sOd+aZbVy r X-Google-Smtp-Source: AGHT+IFJAnFB7UP6N+55dkCdH3hTRQGgb8OTOJhhCbGNQXgV3oJBz6HPynYJEfalNkydAZNCLYrPsw== X-Received: by 2002:a05:6a21:2d05:b0:1d9:1124:ab06 with SMTP id adf61e73a8af0-1d978aeade5mr5561296637.8.1729740039270; Wed, 23 Oct 2024 20:20:39 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec1324d41sm6999533b3a.57.2024.10.23.20.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 20:20:38 -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 v27 03/14] windows: update os shim Date: Wed, 23 Oct 2024 20:18:41 -0700 Message-ID: <20241024032026.415122-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241024032026.415122-1-stephen@networkplumber.org> References: <20200814173441.23086-1-stephen@networkplumber.org> <20241024032026.415122-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