From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC599606A32F for ; Fri, 4 Dec 2026 19:50:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=mnfwUSe+ Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B10DA40B8D; Fri, 4 Dec 2026 20:50:02 +0100 (CET) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTPS id 6BD4F40693 for ; Fri, 4 Dec 2026 20:50:01 +0100 (CET) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2e9ae391a05so10169505ad.1 for ; Fri, 04 Dec 2026 11:50:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796413800; x=1797018600; 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:content-type; bh=s1KBAUjwxBZFE648qVuian4va7BAGQK3TB2S5ER0XHE=; b=mnfwUSe+XSqe9a3z16HlBn1odrTM0SjHWxzetanglUO6vJCxlw4iJOH3Xy9Pj9Of7+ 4J59h7vpVQZmwHIMCpyJ3xonyofU7VPRiqM+fTgP9L+PvywcSd1mUY0pffpiTbxp6f2+ 0C3BUEHGBkySZ6ucAwKQxdVb+PWwVhyGo1s7dsLfAr3XbpOyCmHldi/lroS3xO0gMYRp Zx3yoAHIKQpDs3NDoedNQ42Jsdeo/E/V5ixPOmJBPXp9QgdHTPf2XvP0RwcMmirrCggl Pl+q0cyvCPN42sG+ZxZHEx34aF3zDIIBwnGeiPuOMCGSKVmxPVFtlujSq16b0+BqIYCP 444A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796413800; x=1797018600; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=s1KBAUjwxBZFE648qVuian4va7BAGQK3TB2S5ER0XHE=; b=YuSV/wf75SpjCB1cK+w6+SMArktrKO6/pIcKkfTR3Gas1w8iqAMGEWBaXIu2+nIfpe 4s8qq2YvXDVNPPo0YNMRHfTnUsqAZGi8wn0Efz3/OTwJ6Z5895AIZXuI+6vogpbnjLBN GZqfD4r09Uxaw+fnStA4+eUmV/WGP4fpdaI6WkZKVAjC1KE6EFk9aHQwyRTtEoRSvq8C lruU9kcqfD7J/7UT+J2Krddglu04b48qrs06WC7QKITMSEL1q62nZ54g6yzARtAmYQQ6 UKyvSmO0zGybTL0/oprVpqsTu5KUIWvN3BrcsveGafgbrTN1YQcoN5RxoTrPtUSmLZVB ZzUA== X-Gm-Message-State: AB4q+uE2u7B4ZrMZKiM2lEZ+y3Fm+jWSGg2fEct+jWvc5nnodd9D3F0g MZwqbJATBWUXg2isNnPgXYcnlILeU+9m8Fks0uoIJ4XU9bwcyyhjd0kaSMdK+wf69/uZmMo7dGx YOaVsMtc= X-Gm-Gg: AZFdTZcQ1I2Q/SFN9P/lFIoC3tFq620A44q0eSxUnfZjLQGwLnxDvTBcKKODGW8gZbk FGnHrGc99eY1WVnorQSF/mOl9jiAR5o71O7Oojq211+NczvqWQDxCASdadJMUZ+Y+qx6rB8VnLL hCMbq1nqjuAFmvfVztmyYyQv9wWI4A2zfWn7knSadlF9iDeaFxmLyd7f9N2hIefUN2Try9d6cx1 kYGYTKWNTdwh6TKAMY09fwxqZmwg2ZPZDQJ7RSVri8Fs9l0W5qilIJM9lBvhZA5UsRFvrHCDECg eZrD4pYq2JjQSZ4/l1B6V7FUlz05cNa6arD9FZViZyShOPlxOWB7GjBtDZzQ4qsMEdjKTx8ljez Elxsuc8mt84hFafIgRum8M9o6L1/hkbh84enKeQpS8CYoxkmRJkCnas5r1EebJpN/q0R+QkxeZv pVDKfTNZ6/ER3ojZ2N46QRvw4C4O0B/lGCrA8/GzuKwgoCN2NDE1vpWlFDsLiReppRHGWg3UFdd XAEpN97rQLvSZrRKxq/bnwXAryTn/7FK03GyMt+9qvHC0rOaVVl69hytBDdOgzD3iwZvP1uVA85 JI/oekqZYInXl4UmsDV/pXArLBhw5IK1mPk+dq5sGwwbZJQmKYuEUJYmyPK5DVGdJflExQ== X-Received: by 2002:a17:903:4b30:b0:2f0:eea8:bc05 with SMTP id d9443c01a7336-2f1971ba255mr39624955ad.41.1796413799831; Fri, 04 Dec 2026 11:49:59 -0800 (PST) Received: from phoenix.lan (204-195-112-43.wavecable.com. [204.195.112.43]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f1b791c186sm17627455ad.31.2026.12.04.11.49.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 11:49:59 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Dmitry Kozlyuk Subject: [PATCH v2 1/3] eal/windows: add sleep() shim Date: Fri, 4 Dec 2026 11:43:57 -0800 Message-ID: <20261204194956.803171-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261204194956.803171-1-stephen@networkplumber.org> References: <20261017194856.2950241-1-stephen@networkplumber.org> <20261204194956.803171-1-stephen@networkplumber.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Microsoft libc does not provide sleep(), so code that wants to wait a few seconds has to be wrapped in RTE_EXEC_ENV_WINDOWS conditionals or use rte_delay_us_sleep() instead. Add a sleep() to the Windows unistd.h shim, implemented with rte_delay_us_sleep(). Nothing on Windows interrupts the wait so it always returns 0, not the number of seconds remaining. Signed-off-by: Stephen Hemminger --- lib/eal/windows/include/unistd.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/eal/windows/include/unistd.h b/lib/eal/windows/include/unistd.h index f95888f4e1..456eb19718 100644 --- a/lib/eal/windows/include/unistd.h +++ b/lib/eal/windows/include/unistd.h @@ -5,13 +5,14 @@ #ifndef _UNISTD_H_ #define _UNISTD_H_ /** - * This file is added to support common code in eal_common_lcore.c - * as Microsoft libc does not contain unistd.h. This may be removed - * in future releases. + * This file provides the parts of unistd.h that are used by DPDK + * but missing from Microsoft libc. */ #include +#include + /* * Windows appears to be missing STD*_FILENO macros, so define here. * For simplicity, assume that if STDIN_FILENO is missing, all are, @@ -30,4 +31,19 @@ #define R_OK 0x04 /* test for read permission */ #endif +/* + * Microsoft libc has no sleep(). Nothing on Windows interrupts the + * wait, so unlike POSIX this always sleeps the full time and returns 0 + * rather than the number of seconds left. Loop a second at a time to + * avoid overflowing the microsecond argument. + */ +static inline unsigned int +sleep(unsigned int seconds) +{ + while (seconds-- > 0) + rte_delay_us_sleep(US_PER_S); + + return 0; +} + #endif /* _UNISTD_H_ */ -- 2.53.0