LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Ulrich Drepper <drepper@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] utimensat implementation
Date: Thu, 26 Apr 2007 16:25:30 -0700	[thread overview]
Message-ID: <20070426162530.bc30a1bb.akpm@linux-foundation.org> (raw)
In-Reply-To: <200704262249.l3QMn5C2021588@devserv.devel.redhat.com>

On Thu, 26 Apr 2007 18:49:05 -0400 Ulrich Drepper <drepper@redhat.com> wrote:

> 
> The next revision of POSIX will support fine-grained filesystem timestamps the way we already support.  struct stat will report nanosecond values.  So far so good.
> 
> During the development one additional problem was found: there is no interface to set the file timestamp with that precision.  utimes only takes a timeval structure which allows only micro-second resolution.

Does the spec say what the OS should do if (ts_nsec => 1e9)?

> This is why the utimensat() interface was created.  It is basically the same as our futimesat() interface but it takes a timespec structure.
> 
> While adding this new interface two more features got added.  Programmers sometimes/often only want to set one value.  This currently requires reading the current value with stat() and then use this value in the futimesat() call.  This is slow and might create even wrong results (the file could have been updated in the meantime).  If the tv_nsec value of either of the elements of the utimes parameter to utimensat() is UTIME_OMIT no update of that respective value is performed.

ITYM "If the value of either of the elements..."

+#define UTIME_NOW	((1l << 30) - 1l)
+#define UTIME_OMIT	((1l << 30) - 2l)

OK, so there's no collision on ts_nsec if unnormalised timespecs are
disallowed.

But there's a potential collision on ts_sec?  Do we know what date that
corresponds to?

> The second extension allows to set one of the values to the correct current time.  Today it is only possible to set both values at the same time.  Once again this is slower and might to lead to incorrect results.  The use of UTIME_NOW for the respective tv_nsec value implements this functionality.
> 
> The resulting patch is attached.  It modifies the do_utimes function which is also used in the compat code.  The callers are adjusted.  Most of the added code are checks for invalid parameters.  In fact, I think one problem where the old code wouldn't recognize certain overflows (if tv_nsec * 1000 overflows).
> 
> I've tested the code on x86-64.

Do you have a testcase app which can be used by arch maintainers?


  reply	other threads:[~2007-04-26 23:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-26 22:49 Ulrich Drepper
2007-04-26 23:25 ` Andrew Morton [this message]
2007-04-27  0:11   ` H. Peter Anvin
2007-04-27  0:55     ` Ulrich Drepper
2007-04-27  0:58       ` H. Peter Anvin
2007-04-27  1:04         ` Ulrich Drepper
2007-04-27 23:15           ` H. Peter Anvin
2007-04-27 23:05             ` David Lang
2007-04-27 23:30             ` Ulrich Drepper
2007-04-27 23:33               ` H. Peter Anvin
2007-04-27  0:54   ` Ulrich Drepper
2007-04-27 15:27     ` Updated utimensat test program Ulrich Drepper
2007-04-27  1:57 ` [PATCH] utimensat implementation Neil Brown
2007-04-27  2:13   ` Ulrich Drepper
2007-04-27  6:01     ` Neil Brown
2007-05-10 18:26     ` Ulrich Drepper
2007-05-10 18:52       ` Christoph Hellwig
2007-05-10 19:44         ` Ulrich Drepper
2007-05-13 21:02           ` Christoph Hellwig
2007-05-11  1:01         ` H. Peter Anvin
2007-05-11  2:14       ` Neil Brown

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=20070426162530.bc30a1bb.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] utimensat implementation' \
    /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

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 NNTP newsgroup(s).