-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
Some OS/filesystem combos support file birth/creation times as a user-modifiable attribute. Windows and macOS, at least, are in this boat, and possibly also FreeBSD and NetBSD.
- Windows: Supported by the
SetFileTimeAPI already in use by filetime. - macOS: Maybe not supported by
utimensat/futimens, but supported bysetattrlist. - BSDs: Supported by
timensat/futimensunder FreeBSD/NetBSD, though apparently not by OpenBSD. Requires some date logic which I'm having trouble wrapping my head around, and two syscalls.- https://www.freebsd.org/cgi/man.cgi?query=utimensat&apropos=0&sektion=2&manpath=FreeBSD+13.0-RELEASE+and+Ports&arch=default&format=html
- https://man.netbsd.org/utimensat.2
- https://man.openbsd.org/utimensat.2
- I see the
from_creation_timelogic in src/unix/mod.rs only supports FreeBSD and OpenBSD, so I assume the NetBSD limitation is known.
- Other OSes: ??? Probably not Android, since it's Linux-based. I haven't looked into Solaris/Illumos/Haiku/Redox.
Although Linux added support for reading btimes with statx in 4.11, they seem to have decided that it is only for internal filesystem use, and thus should not be settable by normal means. There was a proposal to come up with a standard xattr for logical file creation time, but I haven't been able to find any info on whether that ever happened.
If this is acceptable, what should the API look like? I could just add a btime parameter to all of the set_file_times/set_file_handle_times methods, and then return an io::Error or panic for unimplemented platforms.
eMPee584eMPee584eMPee584
Metadata
Metadata
Assignees
Labels
No labels