On 08/06/2010 03:50 PM, Peng Yu wrote: > Hi, > > It seems that the 'change' time is not changed to yesterday. Could > anybody let me know how to change the 'change' time?
POSIX says that atime and mtime are user-settable to arbitrary times via the utimensat() family of syscalls, but that ctime _must_ unfakeably track the current time of any action that changes a file's metadata or contents (utimensat() being one of the a variety of actions that will alter ctime as a side effect, but so will write(), chmod(), ...). This is intentional - there are some algorithms that rely on knowing the last time a file was modified (ctime-based) and other algorithms that only care about the last time the file was (purported) to have been read or written (atime and mtime). The _only_ way to fake a ctime change is to alter your system's current time, do an action that updates ctime to the current moment, then restore the system's current time. But since it is generally a privileged action to alter system time, that means that ordinary users cannot change ctime to anything other than the current time. -- Eric Blake [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
