coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stat: reading btime on linux via statx


From: Bernhard Voelker
Subject: Re: stat: reading btime on linux via statx
Date: Mon, 4 Mar 2019 08:12:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

On 3/4/19 6:20 AM, Pádraig Brady wrote:
> I'll push this now.

Sorry, a bit late:

$ make sc_space_before_open_paren
  space_before_open_paren
             ? statx(AT_FDCWD, filename,
             : statx(fd, "", AT_EMPTY_PATH, STATX_BTIME, &stx)) == 0)
  *** src/stat.c
  maint.mk: the above files lack a space-before-open-paren

And a little question:

+#if HAVE_STATX
+  if (ts.tv_nsec < 0)
+    {
+      struct statx stx;
+      if ((fd < 0
+           ? statx(AT_FDCWD, filename,
+                   follow_links ? 0 : AT_SYMLINK_NOFOLLOW,
+                   STATX_BTIME, &stx)
+           : statx(fd, "", AT_EMPTY_PATH, STATX_BTIME, &stx)) == 0)
+        {
+          if ((stx.stx_mask & STATX_BTIME) && stx.stx_btime.tv_sec != 0)
____________________________________________^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Why do we need this extra check? As I read 'man statx', the test on the stx_mask
should be enough.  And - highly unlikely -: if the BTIME is in the first second
after epoch, then TV_SEC will be 0 while TV_NSEC might not.

Otherwise: nice feature, thanks!

Have a nice day,
Berny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]