Call libc::utimensat directly rather than using filetimes crate#10063
Call libc::utimensat directly rather than using filetimes crate#10063iburaky2 wants to merge 5 commits into
Conversation
…touch permissions when updating time to now
|
GNU testsuite comparison: |
CodSpeed Performance ReportMerging #10063 will improve performance by 3.57%Comparing Summary
Benchmarks breakdown
Footnotes
|
| set_file_times(path, atime, mtime) | ||
| #[cfg(unix)] | ||
| { | ||
| if opts.source == Source::Now |
There was a problem hiding this comment.
please add a comment explaining why you are doing this
|
|
||
| #[test] | ||
| #[cfg(target_os = "linux")] | ||
| #[cfg(all(unix, not(target_os = "openbsd")))] |
There was a problem hiding this comment.
openbsd doesn't have /dev/full
https://man.openbsd.org/MAKEDEV.8
|
@iburaky2 Would you be interesting in continuing? |
|
I remember having trouble testing on all the different platforms. Also I wasn't really happy with moving so much code from the filetime crate to here, I think a better solution would be maybe maintain filetime functionality inside uucore. I'm a bit busy with work atm, feel free to continue from where I left off. |
|
It may be worth someone picking this up again, given that |
#9870 coincidentally works on linux but does not work on platforms where
UTIME_NOWwhich is originally alongdoesn't fit intou32, such as freebsd.It's not possible to use
UTIME_NOWinutimensatwith the filetimes crate on these platforms. I copied the relevant piece of code being called from filetimes so I can calllibc::utimensatdirectly. Providing a nullptr as the times argument as the same effect as bothtv_nsecfields beingUTIME_NOW.For the tests, OpenBSD doesn't have a
/dev/fullbuttouch /dev/nullessentially tests the same permission issue.