Unable to set change_time using vnode_setattr in kernel extension

Hi,

We have a scenario where we take backups of a file. User can select the version to restore from.

We have a kernel extension which while restoring the file, restores all the file attributes.


Code looks like this


struct vnode_attr va;

VATTR_INIT(&va);

SET_VATTR_IF_SUPPORTED(&va, vaFrom, vaDestination, va_change_time);

... other attributes

vnode_setattr(vnode, &vaDestination, context);


This used to work upto macOS 10.13.

On macOS 10.14 onwords, change_time is not set to the given value but to the current timestamp.


Is this expected behavior? Is there any documetation around this?

The reason we restore all attributes is so that other backup softwares don't think that the file was modified.

Replies

Are you sure that things changed with the OS release? Or is this an APFS versus HFS Plus difference?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks eskimo for quick response.

On macOS 10.15, I tested with a dmg file formatted using exfat. The result is same as that for APFS.