Page MenuHomeFreeBSD

restore: Preserve timestamps to the nanosecond
ClosedPublic

Authored by jilles on Mar 6 2015, 11:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 25, 5:11 AM
Unknown Object (File)
Sun, Mar 15, 9:45 AM
Unknown Object (File)
Sun, Mar 15, 9:38 AM
Unknown Object (File)
Sat, Mar 14, 12:54 PM
Unknown Object (File)
Sun, Mar 8, 12:59 AM
Unknown Object (File)
Sun, Mar 8, 12:40 AM
Unknown Object (File)
Jan 31 2026, 2:03 AM
Unknown Object (File)
Jan 2 2026, 6:52 AM
Subscribers

Details

Summary

It appears that sbin/restore already knows the full-resolution timestamps,
so the only thing to do is to stop converting the timespecs to timevals
and use futimens() and utimensat().

Test Plan

Dump and restore a small UFS image with a few file types in it.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

jilles retitled this revision from to restore: Preserve timestamps to the nanosecond.
jilles updated this object.
jilles edited the test plan for this revision. (Show Details)

Looks fine to me. I only have one tangential question: have you thought about making convenience wrappers in libc for utimens() and lutimens() that would call utimensat() with the respective flags?

In D2020#3, @jhb wrote:

Looks fine to me.

Thanks.

I only have one tangential question: have you thought about making convenience wrappers in libc for utimens() and lutimens() that would call utimensat() with the respective flags?

I don't think the benefit (fewer parameters to functions) is worth the cost (more functions, non-standard functions) here. Also, utilities like touch actually benefit from the flag parameter, since it replaces multiple function pointers (stat/lstat and utimes/lutimes) with one flag variable (0/AT_SYMLINK_NOFOLLOW).

jilles updated this revision to Diff 4223.

Closed by commit rS279986 (authored by @jilles).