From patchwork Thu Feb 22 12:50:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitriy Chestnykh X-Patchwork-Id: 1902756 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=MnoGdvfJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=uclibc-ng.org (client-ip=2a00:1828:2000:679::23; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=patchwork.ozlabs.org) Received: from helium.openadk.org (helium.openadk.org [IPv6:2a00:1828:2000:679::23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TgY1Z68Nnz23hY for ; Thu, 22 Feb 2024 23:51:44 +1100 (AEDT) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id C6039352D287; Thu, 22 Feb 2024 13:51:36 +0100 (CET) Authentication-Results: helium.openadk.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=MnoGdvfJ; dkim-atps=neutral Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by helium.openadk.org (Postfix) with ESMTPS id BB688352D280 for ; Thu, 22 Feb 2024 13:51:09 +0100 (CET) Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2cd3aea2621so27106481fa.1 for ; Thu, 22 Feb 2024 04:51:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708606268; x=1709211068; darn=uclibc-ng.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=glEdbI3FPkHHpKMu5Fo7dyCYk2ikHA3nttDwHJY5vUY=; b=MnoGdvfJZkFtXUnnMtT5x1yqBUCmYPFv/Sp+fxCWdnkjWatI5LEKRKYSi11XtWEFwI LJObQ+bGqisAX2Oz+3W+Lsf7Mz4Fh0Hyfe9i2yICAu7eh4fVlXe8nUB5eAULq6h4knCm JkCpxi+0siwSEOwaBhUjFGAnq3rRnUzw4vCmo3vxqQ7d8hqd2e4fpITvYGkOpcU8psS7 NMA0i1eSE7NObz2PvlcqmQXtffa04C14JxaxXP11VUNX+wRuTtMvsFIz31G5/9lU8mYs uaeI+1wAOinXwywYhOSIMjjVjVb5AT80QpazqMhz0ppnldRnHRWDKE+BOXImv8VI+06u syUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708606268; x=1709211068; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=glEdbI3FPkHHpKMu5Fo7dyCYk2ikHA3nttDwHJY5vUY=; b=qEEXIZh2iVB2/+xodOAeZc3ZpiMY+MihVlmuJLKIJGUntTbatdNTYlAx+vfrcFYHuQ y2cQM7e39PceBFHDsOSRDbdfk0bYlLw5WTBCKqAgPhzUFboMoYoIkHKA3TeIKNQut2Jp a6hgiJjOLXeeYQ8nQuvDp6XplPYHAqbemfRAed5klJL27akpQyFCs3uwx0pD1n0hesj8 36iWtdbr70k+CjqAfAq3Kl95QgH4CXGfZnfL3oR0YEoCo+ZmNG9fjJGhZ96cYJWsTltv OvUGM/OPZQcJduSfgOJIW0xRBonapEaSXu56FUz82ogena+tSMrm/u5HNj6XuOqwyVad 6HsQ== X-Gm-Message-State: AOJu0YwZb/JfsgHcDtq43o/3n1hj96a+ltXYdcMqbVuupFtov1xnF4v4 rXnC2AcAUQTHqB33CydQRyNKAgWuiIFPy5fxiuV4Rwlj7mLcsHP8fMx/8EfK X-Google-Smtp-Source: AGHT+IF7bwAceTGIbHLd2aS263luodxaVoaAS1rkG0iWn9QAoXAOZf/MOU2xpIx0Rbn6k6ZCAPe2Ig== X-Received: by 2002:a2e:9787:0:b0:2d2:3d37:c9e1 with SMTP id y7-20020a2e9787000000b002d23d37c9e1mr7071276lji.4.1708606268041; Thu, 22 Feb 2024 04:51:08 -0800 (PST) Received: from localhost.localdomain ([2a00:1370:817a:d2b8:7ffb:a727:912d:9d62]) by smtp.gmail.com with ESMTPSA id f21-20020a2ea0d5000000b002d0d945e729sm2265015ljm.98.2024.02.22.04.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 04:51:07 -0800 (PST) From: Dmitry Chestnykh To: devel@uclibc-ng.org Date: Thu, 22 Feb 2024 15:50:51 +0300 Message-ID: <20240222125051.2341214-1-dm.chestnykh@gmail.com> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 Message-ID-Hash: NRCS2AKUZYPKQNWJ2F6ZQPQCUI35JGLB X-Message-ID-Hash: NRCS2AKUZYPKQNWJ2F6ZQPQCUI35JGLB X-MailFrom: dm.chestnykh@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Dmitry Chestnykh X-Mailman-Version: 3.3.3 Precedence: list Subject: [uclibc-ng-devel] [PATCH] xtensa: Add time64 support. List-Id: uClibc-ng Development Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: - xtensa is the second architecture that supports time64 inside uClibc-ng. - Linux Kernel always uses 32bit time variables inside `stat` structures, so there is a need to use `st_atime`, `st_mtime` and `st_ctime` structures with the same 32bit-wide `tv_sec` and `tv_nsec` variables even if time64 is enabled. Signed-off-by: Dmitry Chestnykh Reviewed-by: Max Filippov --- extra/Configs/Config.in | 2 +- libc/sysdeps/linux/xtensa/bits/kernel_stat.h | 22 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index 831b9f689..9351dffc8 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -1026,7 +1026,7 @@ config UCLIBC_FALLBACK_TO_ETC_LOCALTIME config UCLIBC_USE_TIME64 bool "Use *time64 syscalls instead of 32bit ones (if possible)" - depends on TARGET_arm + depends on TARGET_arm || TARGET_xtensa # TODO: add support for other architectures default n diff --git a/libc/sysdeps/linux/xtensa/bits/kernel_stat.h b/libc/sysdeps/linux/xtensa/bits/kernel_stat.h index d884344d3..80ccdb76a 100644 --- a/libc/sysdeps/linux/xtensa/bits/kernel_stat.h +++ b/libc/sysdeps/linux/xtensa/bits/kernel_stat.h @@ -5,6 +5,16 @@ * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ +#if defined(__UCLIBC_USE_TIME64__) +#include + +struct ts32_struct { + __S32_TYPE tv_sec; + __S32_TYPE tv_nsec; +}; + +#endif + struct kernel_stat { unsigned long st_dev; unsigned long st_ino; @@ -16,9 +26,15 @@ struct kernel_stat { long st_size; unsigned long st_blksize; unsigned long st_blocks; +#if defined(__UCLIBC_USE_TIME64__) + struct ts32_struct __st_atim32; + struct ts32_struct __st_mtim32; + struct ts32_struct __st_ctim32; +#else struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; +#endif unsigned long __unused4; unsigned long __unused5; }; @@ -35,9 +51,15 @@ struct kernel_stat64 { unsigned long st_blksize; /* Optimal block size for I/O. */ unsigned long __uclibc_unused2; unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ +#if defined(__UCLIBC_USE_TIME64__) + struct ts32_struct __st_atim32; + struct ts32_struct __st_mtim32; + struct ts32_struct __st_ctim32; +#else struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ +#endif unsigned long __uclibc_unused4; unsigned long __uclibc_unused5; };