Date: Mon, 7 Nov 2011 09:18:18 -0800 From: mdf@FreeBSD.org To: "Ronald F. Guilmette" <rfg@tristatelogic.com> Cc: freebsd-fs@freebsd.org Subject: Re: write access to various times Message-ID: <CAMBSHm8ry6wF8z-ELhfAqrC7zzARat-YgZa8ymofHq16aQbxOg@mail.gmail.com> In-Reply-To: <60946.1320475599@tristatelogic.com> References: <60946.1320475599@tristatelogic.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Nov 4, 2011 at 11:46 PM, Ronald F. Guilmette <rfg@tristatelogic.com> wrote: > It would appear that in 8.2-RELEASE, at least, each "struct stat" contain= s > four fields, each of type "timespec", and having the following names: > > =A0 =A0st_atimespec > =A0 =A0st_mtimespec > =A0 =A0st_ctimespec > =A0 =A0st_birthtimespec > > I already know that if I want to modify either (or both) of the first > two fields listed above, I should call utimes(2). =A0But what do I do if = I need > to modify the values of either or both of the other two fields? =A0(I may= want > to do this, e.g. if I am trying to restore all of the struct stat fields > from a backed-up representation of some original filesystem entry.) > > The current man page for utimes(2) says (among other things): > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > =A0 =A0 ... > =A0 =A0 If times is non-NULL, it is assumed to point to an array of two t= imeval > =A0 =A0 structures. =A0The access time is set to the value of the first e= lement, > =A0 =A0 and the modification time is set to the value of the second eleme= nt. =A0For > =A0 =A0 file systems that support file birth (creation) times (such as UF= S2), the > =A0 =A0 birth time will be set to the value of the second element if the = second > =A0 =A0 element is older than the currently set birth time. =A0To set bot= h a birth > =A0 =A0 time and a modification time, two calls are required; the first t= o set > =A0 =A0 the birth time and the second to set the (presumably newer) modif= ication > =A0 =A0 time. =A0Ideally a new system call will be added that allows the = setting of > =A0 =A0 all three times at once... > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > > Is there any ETA for this postulated new system call? To my knowledge, no. I think this was a hopeful statement on the original author's part. AFAIK no one is working on this change. We have a patch at $WORK that adds a vtimes(2) syscall with support for setting birthtime as well as mtime and atime. Some day [1] I may be able to upstream this functionality back to FreeBSD. [1] predicated on continued employment, change of roles at $WORK, time, and community acceptance of the changes. A rough estimate would be sometime in the middle or end of 2012. Cheers, matthew > Also, of course, although the method described above for setting the valu= e of > the st_birthtimespec field is rather clumsey and inefficient, at least th= ere > _is_ a way to set that field. =A0I am concerned however because I persona= lly > still know of no way whatsoever to set the value of the st_ctimespec fiel= d. > Is there any way to do that? > > It would be most helpful to have that too.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMBSHm8ry6wF8z-ELhfAqrC7zzARat-YgZa8ymofHq16aQbxOg>