From: Stefan Liebler <stli@linux.ibm.com>
To: libc-alpha@sourceware.org
Subject: Re: [PATCH 4/5] support: Add support_path_support_time64_value
Date: Fri, 26 Mar 2021 10:24:40 +0100 [thread overview]
Message-ID: <65d9d404-4def-436d-bd80-0a7af75df1c9@linux.ibm.com> (raw)
In-Reply-To: <20210319183121.2252064-5-adhemerval.zanella@linaro.org>
On 19/03/2021 19:31, Adhemerval Zanella via Libc-alpha wrote:
> It allows to check for support on arbitrary timestamp values.
> ---
> support/support.h | 11 +++++++++--
> support/support_path_support_time64.c | 10 +++-------
> 2 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/support/support.h b/support/support.h
> index 2e477c9e7c..5757c40833 100644
> --- a/support/support.h
> +++ b/support/support.h
> @@ -130,9 +130,16 @@ extern void support_copy_file (const char *from, const char *to);
> extern ssize_t support_copy_file_range (int, off64_t *, int, off64_t *,
> size_t, unsigned int);
>
> -/* Return true is PATH supports 64-bit time_t interfaces for file
> +/* Return true if PATH supports 64-bit time_t interfaces for file
> operations (such as fstatat or utimensat). */
> -extern bool support_path_support_time64 (const char *path);
> +extern bool support_path_support_time64_value (const char *path, int64_t at,
> + int64_t mt);
> +static __inline bool support_path_support_time64 (const char *path)
> +{
> + /* 1s and 2s after y2038 limit. */
> + return support_path_support_time64_value (path, 0x80000001ULL,
> + 0x80000002ULL);
> +}
>
> __END_DECLS
>
> diff --git a/support/support_path_support_time64.c b/support/support_path_support_time64.c
> index 452fedcde5..33b2bdff66 100644
> --- a/support/support_path_support_time64.c
> +++ b/support/support_path_support_time64.c
> @@ -36,19 +36,15 @@ utimesat_call (const char *path, const struct __timespec64 tsp[2])
> #endif
>
> bool
> -support_path_support_time64 (const char *path)
> +support_path_support_time64_value (const char *path, int64_t at, int64_t mt)
> {
> #ifdef __linux__
> /* Obtain the original timestamps to restore at the end. */
> struct statx ostx;
> TEST_VERIFY_EXIT (statx (AT_FDCWD, path, 0, STATX_BASIC_STATS, &ostx) == 0);
>
> - const struct __timespec64 tsp[] =
> - {
> - /* 1s and 2s after y2038 limit. */
> - { 0x80000001ULL, 0 },
> - { 0x80000002ULL, 0 }
> - };
> + const struct __timespec64 tsp[] = { { at, 0 }, { mt, 0 } };
> +
> /* Return is kernel does not support __NR_utimensat_time64. */
> if (utimesat_call (path, tsp) == -1)
> return false;
>
OK
next prev parent reply other threads:[~2021-03-26 9:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-19 18:31 [PATCH 0/5] More stat fixes Adhemerval Zanella
2021-03-19 18:31 ` [PATCH 1/5] linux: Implement fstatat with __fstatat64_time64 Adhemerval Zanella
2021-03-23 16:13 ` Stefan Liebler
2021-03-26 9:24 ` Stefan Liebler
2021-03-26 19:32 ` Adhemerval Zanella
2021-03-19 18:31 ` [PATCH 2/5] linux: Disable fstatat64 fallback if __ASSUME_STATX is defined Adhemerval Zanella
2021-03-26 9:24 ` Stefan Liebler
2021-03-26 19:38 ` Adhemerval Zanella
2021-03-19 18:31 ` [PATCH 3/5] linux: Use statx for MIPSn64 Adhemerval Zanella
2021-03-29 12:48 ` Adhemerval Zanella
2021-04-01 0:07 ` Maciej W. Rozycki
2021-04-01 12:45 ` Adhemerval Zanella
2021-04-01 18:00 ` Maciej W. Rozycki
2021-03-19 18:31 ` [PATCH 4/5] support: Add support_path_support_time64_value Adhemerval Zanella
2021-03-26 9:24 ` Stefan Liebler [this message]
2021-03-19 18:31 ` [PATCH 5/5] linux: Add y2106 support on utimensat tests Adhemerval Zanella
2021-03-26 9:24 ` Stefan Liebler
2021-03-26 19:40 ` Adhemerval Zanella
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=65d9d404-4def-436d-bd80-0a7af75df1c9@linux.ibm.com \
--to=stli@linux.ibm.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).