Re: file changes content but ContentModificationDate not changing
Re: file changes content but ContentModificationDate not changing
- Subject: Re: file changes content but ContentModificationDate not changing
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Thu, 06 Nov 2014 11:20:26 +0700
> On 5 Nov 2014, at 23:47, Quinn The Eskimo! <email@hidden> wrote:
>
> On 5 Nov 2014, at 16:43, Gerriet M. Denkmann <email@hidden> wrote:
>
>> On 5 Nov 2014, at 20:31, Quinn The Eskimo! <email@hidden> wrote:
>>
>>> It [i.e. the inode] should change each time the file is saved.
>>
>> It should, but it does not.
>
> Curious. Alas, the source for ntpd is complex enough that I may be looking at completely the wrong code. On option here is to use fs_usage to see what system calls ntpd is using to make this change and track things from there.
Following your advice I found a way to change a file without DISPATCH_SOURCE_TYPE_VNODE noticing it (same way save_drift_file() in ntp_util.c does it):
static void *mmap_addr;
static off_t stats_size;
if ( mmap_addr == NULL )
{
// will receive DISPATCH_VNODE_ATTRIB (sometimes twice)
NSLog(@"%s will write %g (case 2: setting mmap_addr)",__FUNCTION__, drift_comp * 1e6);
int fd = open(stats_drift_file, O_RDWR);
if ( fd < 0 ) ... // error
mmap_addr = mmap(0, pageSize, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, 0);
if (mmap_addr == MAP_FAILED) ... // error
off_t n = snprintf(mmap_addr, pageSize, "%.3f\n", drift_comp * 1e6);
if (n != stats_size)
{
truncate(stats_drift_file, n);
stats_size = n;
};
close(fd);
}
else // stealth-mode
{
// will receive no DISPATCH_VNODE_XXX at all
// does NOT update the change-time of stats_drift_file
NSLog(@"%s will write %g (case 3: stealth-mode using mmap)",__FUNCTION__, drift_comp * 1e6);
off_t n = snprintf(mmap_addr, pageSize, "%.3f\n", drift_comp * 1e6);
if (n != stats_size) // size of ntp.drift changed
{
truncate(stats_drift_file, n);
stats_size = n;
};
};
Question: is this the way it should be? Or is this stealth-mode a bug?
Kind regards,
Gerriet.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden