Page MenuHomeFreeBSD

restore: Preserve timestamps to the nanosecond
ClosedPublic

Authored by jilles on Mar 6 2015, 11:02 PM.
Tags
None
Referenced Files
F135814001: D2020.id4223.diff
Thu, Nov 13, 3:36 AM
Unknown Object (File)
Mon, Nov 10, 5:19 AM
Unknown Object (File)
Tue, Nov 4, 4:04 AM
Unknown Object (File)
Oct 6 2025, 5:27 PM
Unknown Object (File)
Sep 25 2025, 1:28 PM
Unknown Object (File)
Sep 22 2025, 7:03 PM
Unknown Object (File)
Sep 22 2025, 4:18 PM
Unknown Object (File)
Sep 20 2025, 11:56 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).