Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Mar 2012 23:25:27 +0100
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Sergey Kandaurov <pluknet@gmail.com>
Cc:        d@delphij.net, freebsd-arch@freebsd.org
Subject:   Re: RFC: futimens(2) and utimensat(2)
Message-ID:  <20120302222526.GB6416@stack.nl>
In-Reply-To: <CAE-mSOJU=hm8%2B-AC_oQmx%2Bh2grv7PGaH7kNYKoT3GMePDPXsYg@mail.gmail.com>
References:  <4F4DC876.3010809@delphij.net> <CAE-mSOJU=hm8%2B-AC_oQmx%2Bh2grv7PGaH7kNYKoT3GMePDPXsYg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 29, 2012 at 02:21:23PM +0300, Sergey Kandaurov wrote:
> On 29 February 2012 10:40, Xin Li <delphij@delphij.net> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA256

> > These are required by IEEE Std 1003.1-2008. ?Patchset at:

> > http://people.freebsd.org/~delphij/for_review/utimens.diff

> First, thank you very much for doing this.

> ERRORS section for utimes(2) is still not updated (not exists).
> Funny but that was the most difficult part to implement these
> syscalls a year ago with the great help from jilles@.
> He could further comment on your patchset.

> Otherwise looks good and pretty similar to my work, though
> I didn't use a "const" modifier in my version for both functions
> and syscall definitions in syscall.master for some reasons.

> Further I wrote a test to see how properly implementation detects
> EACCES/EPERM with different UTIME_OMIT/UTIME_NOW passed. It shall pass
> all tests as shown in the table (stolen somewhere from austingroup):

>   [a]    [b]      [c]
>  times  file     file
>  arg.    UID      is
>  NULL   owner   writable        Result
>  !NULL  !owner  !writable
> 
>  N      o          w            success
>  N      o          !w           success
>  N      !          w            success
>  N      !o         !w           EACCES [1]
>  !N     o          w            success
>  !N     o          !w           success
>  !N     !o         w            EPERM [2]
>  !N     !o         !w           EPERM [3]

> Here NULL also covers cases when:
> - both fields are UTIME_NULL
> - both fields are UTIME_OMIT.

If both fields are UTIME_NOW, this shall be the same as a NULL pointer.
If both fields are UTIME_OMIT, the timestamps remain unchanged; no
permission check shall be performed for the file itself but may be
performed for the path prefix (an earlier patch from pluknet returned
success immediately).

Otherwise, the above is correct.

Note that if one field is UTIME_NOW and the other is UTIME_OMIT, there
is no special case: the caller must be owner or root.

-- 
Jilles Tjoelker



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120302222526.GB6416>