-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support getting file metadata on Windows #4067
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Here are some comments for the first and last commit, I skipped the second one for now.
Before we get too much further on this PR, I'd like to point out 296d806 (which I just pushed) on the big PR. It's the changes needed to FileDescription methods to make them platform-agnostic enough for Windows use-cases. If they look fine, we can continue, but if you think it's a bad design then the FileDescription trait will need entirely split in two, which will change code even in this PR. |
Reducing the places where we have to use global state like errno seems like an improvement. But please use |
@rustbot ready |
src/shims/windows/fs.rs
Outdated
const TIME_TO_EPOCH: u64 = 31_556_926 * 369 * 10_000_000; | ||
match time.ok() { | ||
Some(time) => { | ||
let duration = system_time_to_duration(&time)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably rename this to system_time_since_unix_epoch
. (Can be a future PR though.)
Okay I finally had a look at the core new file in this PR. :) |
@rustbot ready |
☔ The latest upstream changes (presumably #4068) made this pull request unmergeable. Please resolve the merge conflicts. |
@rustbot author |
Thanks, sorry for the unnecessary ping then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patience!
@rustbot author |
@rustbot review |
This comment has been minimized.
This comment has been minimized.
- consistent handling, invalid handles are always an abort - Helper for reading handles that does the checking and machine stop - Use real handle types more places - Adds `File` and `Invalid` types of handle. File support will be added next
894e7bd
to
5207cae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! I'm happy with the general approach and structure now, we're just finalizing comments and style. :)
@rustbot author
Reminder, once the PR becomes ready for a review, use |
Thanks for the patience and help with getting this over the line! After this merges, I'll work to flesh out the shims more, make it so you can actually do useful things with files targeting Windows. @rustbot ready |
Thank you for your patience with the sometimes slow round-trip times. :) This looks great, thanks! Please squash the commits, then we can land this. Please use the @rustbot author |
… enough to get file metadata.
ae74cad
to
731308f
Compare
@rustbot review |
Main changes are the first two commits - one refactors handles a bit to make their usage more consistent and adds the file variant, the other actually adds the metadata shims.
This also changes miri to never return invalid handle errors, instead always treating them as an error. This behavior matches that of code running under the MSVC debugger - invalid handles are treated as exceptions in debug contexts.
Split off #4043