Add stat and lstat shims for all Unixes#4934
Open
enricobolzonello wants to merge 2 commits intorust-lang:masterfrom
Open
Add stat and lstat shims for all Unixes#4934enricobolzonello wants to merge 2 commits intorust-lang:masterfrom
stat and lstat shims for all Unixes#4934enricobolzonello wants to merge 2 commits intorust-lang:masterfrom
Conversation
Collaborator
|
Thank you for contributing to Miri! A reviewer will take a look at your PR, typically within a week or two. |
RalfJung
reviewed
Apr 26, 2026
Member
There was a problem hiding this comment.
Sorry for the slow review.
This looks just right, thanks! However, the test could do with a bit of code deduplication.
@rustbot author
Comment on lines
+501
to
+516
| // Check that all fields are initialized. | ||
| let _st_nlink = stat.st_nlink; | ||
| let _st_blksize = stat.st_blksize; | ||
| let _st_blocks = stat.st_blocks; | ||
| let _st_ino = stat.st_ino; | ||
| let _st_dev = stat.st_dev; | ||
| let _st_uid = stat.st_uid; | ||
| let _st_gid = stat.st_gid; | ||
| let _st_rdev = stat.st_rdev; | ||
| let _st_atime = stat.st_atime; | ||
| let _st_mtime = stat.st_mtime; | ||
| let _st_ctime = stat.st_ctime; | ||
| let _st_atime_nsec = stat.st_atime_nsec; | ||
| let _st_mtime_nsec = stat.st_mtime_nsec; | ||
| let _st_ctime_nsec = stat.st_ctime_nsec; | ||
|
|
Member
There was a problem hiding this comment.
Instead of duplicating this code, please move it into a shared function.
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4744
Adds
statandlstatshims for Linux, following the same approach as #4714 did forfstat."stat"and"lstat"arms to the generic Unix foreign items handlerOs::Linuxto the supported targets infs.rsfor both functionsstatandlstat. The test forlstatverifies it does not follow symlinks