[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coreutils] How to change the "Change" time? (touch)
From: |
Eric Blake |
Subject: |
Re: [coreutils] How to change the "Change" time? (touch) |
Date: |
Fri, 06 Aug 2010 16:09:58 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100805 Red Hat/3.1.2-2.el6 Mnenhy/0.8.3 Thunderbird/3.1.2 |
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 address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature