From owner-freebsd-fs@FreeBSD.ORG Sat Feb 11 10:48:01 2012 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C072106564A for ; Sat, 11 Feb 2012 10:48:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8ACBD8FC0A for ; Sat, 11 Feb 2012 10:48:00 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q1BAlo3e022410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 11 Feb 2012 21:47:51 +1100 Date: Sat, 11 Feb 2012 21:47:50 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Sergey Kandaurov In-Reply-To: Message-ID: <20120211204120.N2344@besplex.bde.org> References: <20120210135527.GR1860@hoeg.nl> <20120211042121.B3653@besplex.bde.org> <20120211121947.M903@besplex.bde.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-688338940-1328957270=:2344" Cc: Ed Schouten , fs@freebsd.org Subject: Re: Increase timestamp precision? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Feb 2012 10:48:01 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-688338940-1328957270=:2344 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sat, 11 Feb 2012, Sergey Kandaurov wrote: > On 11 February 2012 06:10, Bruce Evans wrote: >> - touch(1) normally uses gettimeofday() and utimes(). =A0Thus it normall= y >> ... > > In POSIX-2008 touch description mentions now that touch shall perform > actions equivalent to futimens() or utimensat() (see below) depending > on whether the specified file exists. It also introduces the concept of > finegrained timestamps - a fractional part of second like: > touch -d "2007-11-12 10:15:30.002Z" > -d is a new way to specify your own time but in ISO 8601:2000 format I saw a little of this on the POSIX mailing list. POSIX has to specify what happens when unrepresentable times are requested to be set or used, not just for file times but also for timeouts. I'm not sure how far it has got. > >> Timstamping bugs not so near here: >> ... >> - POSIX is apparently inventing futimesat(). =A0This only sets timevals. >> =A0POSIX is apparently still failing to invent an interface to set its >> =A0own timespecs. =A0Any utime()-like interface invented after timespecs >> =A0should support timespecs, with setting timevals only supported by >> =A0compatibility cruft in this interface.[...] =A0futimesat() is unfortu= nately being >> =A0standardized[..] > > POSIX.1-2008 invented two *utimes() syscalls since then which both operat= e > on timespecs. > I implemented them a year ago, but failed to commit yet for some reason, > particularity because of overcomplicated utimes(2) man page. Do you mean that the FreeBSD man page is already overcomplicated, and that adding to it work make it more so? It certainly has long descrptions of the possible errors. The following seem to be wrong: % ERRORS % The utimes() and lutimes() system calls will fail if: % ... % [EPERM] The times argument is not NULL and the calling % process's effective user ID does not match the ow= ner % of the file and is not the super-user. %=20 % [EPERM] The named file has its immutable or append-only f= lag % set, see the chflags(2) manual page for more info= rma- % tion. Bad grammar (comma splice). This error can happen for almost all vfs syscalls, and man pages shouldn't be made even more verbose with pointers to chflags(2) for it. They aren't similarly verbose for other attributes, and the flags attribute is now 20 years old, so it should be as familiar as the others. %=20 % [EROFS] The file system containing the file is mounted re= ad- % only. These 3 should apply to all the utimes syscalls, since they are related to writing the results to the underlying file system's inode and not related to the pathname used to access the file. %=20 % In addition to the errors returned by the utimes(), the futimesat() = may % fail if: "may fail"? This weasel for "this standard is broken, so that broken but influential systems can conform to it". > - futimens() is like our futimes() but works with timespec(); > - utimensat() is like our futimesat(). It is "ours" because it was never > standardized. Our manpage for futimesat() only mentions that it "follows > The Open Group Extended API Set 2 specification." > Linux manpage provides somewhat better history: > This system call is nonstandard. It was implemented from a specification= that > was proposed for POSIX.1, but that specification was replaced by the one = for > utimensat(2). Hmm, I just noticed that at least old-POSIX doesn't have futimes() either. futimesns() wouldn't be missed so much in portable code that had to avoid futimes(). I wonder if FreeBSD doesn't need futimes(2) either, since it can try using utimes() on "/dev/stdin" after swapping the fd with 0 in case /dev/fd/ is not present. > utimensat() diverges from futimesat() by enabling usage of timespec and > addition of the optional flag with only one existing bit that follows oth= er > *at() family convention: > AT_SYMLINK_NOFOLLOW > If path names a symbolic link, the symbolic link's dates are > changed. Sounds like POSIX did the right thing, except for not implementing futimens(), but futimens() can easily be implemented as part of utimesnsat() by putting another flag somewhere to indicate that the fd is the thing to be changed and that the string is not used. Bruce --0-688338940-1328957270=:2344--