From owner-freebsd-arch@FreeBSD.ORG Fri Mar 2 22:25:30 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B1641065678 for ; Fri, 2 Mar 2012 22:25:30 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id 78A5C8FC26 for ; Fri, 2 Mar 2012 22:25:29 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 350B41DD633; Fri, 2 Mar 2012 23:25:27 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 1B3C728470; Fri, 2 Mar 2012 23:25:27 +0100 (CET) Date: Fri, 2 Mar 2012 23:25:27 +0100 From: Jilles Tjoelker To: Sergey Kandaurov Message-ID: <20120302222526.GB6416@stack.nl> References: <4F4DC876.3010809@delphij.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: d@delphij.net, freebsd-arch@freebsd.org Subject: Re: RFC: futimens(2) and utimensat(2) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Mar 2012 22:25:30 -0000 On Wed, Feb 29, 2012 at 02:21:23PM +0300, Sergey Kandaurov wrote: > On 29 February 2012 10:40, Xin Li 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