minimal dirfd implementation (1/4) by Qelxiros · Pull Request #146341 · rust-lang/rust (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation123 Commits1 Checks11 Files changed
Conversation
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
[ Show hidden characters]({{ revealButtonHref }})
This is the first of four smaller PRs that will eventually be equivalent to #139514.
A few notes:
- I renamed
newtoopenbecauseopen_dirtakes&selfand opens a subdirectory.- I also renamed
opentoopen_file.
- I also renamed
- I'm not sure how to
impl AsRawFdand friends because thecommonimplementation usesPathBufs. How should I proceed here?
The other PRs will be based on this one, so I'll make drafts and mark them ready as their predecessors get merged. They might take a bit though; I've never done this particular thing with git before.
Tracking issue: #120426
r? @tgross35
try-job: aarch64-apple
try-job: dist-various*
try-job: test-various*
try-job: x86_64-msvc-1
try-job: x86_64-mingw*
Operating system: Windows
Status: Awaiting review from the assignee but also interested parties.
Relevant to the library team, which will review and decide on the PR/issue.
labels
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
rustbot added S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
and removed S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let mut handle = ptr::null_mut(); |
|---|
| let mut io_status = c::IO_STATUS_BLOCK::PENDING; |
| let access = opts.get_access_mode()? | c::SYNCHRONIZE; |
| let options = create_options | c::FILE_SYNCHRONOUS_IO_NONALERT; |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a note about why this flag is set?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I no longer remember why I chose this one, and looking at it now, I'm not sure whether we should set this one, FILE_SYNCHRONOUS_IO_ALERT, or neither. Maybe @ChrisDenton has thoughts?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update, using neither causes an error, so I've added back FILE_SYNCHRONOUS_IO_NONALERT
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, passing this flag is equivalent to not passing FILE_FLAG_OVERLAPPED to CreateFile. So if you don't pass this flag, other APIs using the handle need to follow the usual overlapped rules, otherwise they may behave improperly.
From the top post:
* I'm not sure how to `impl AsRawFd` and friends because the `common` implementation uses `PathBuf`s. How should I proceed here?
I think it would be fine to include the impl AsRawFd only in unix/dir so it's only implemented if we have dirfd. I'll add an unresolved question to the tracking issue.
The other PRs will be based on this one, so I'll make drafts and mark them ready as their predecessors get merged. They might take a bit though; I've never done this particular thing with git before.
That is quite alright, there is no hurry :) For reference, the --update-refs rebase flag can be pretty useful when you're working with a stack (e.g. https://andrewlock.net/working-with-stacked-branches-in-git-is-easier-with-update-refs/)
This comment was marked as outdated.
rust-bors bot added a commit that referenced this pull request
minimal dirfd implementation (1/4)
try-job: aarch64-apple try-job: dist-various* try-job: test-various* try-job: x86_64-msvc* try-job: x86_64-mingw
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
rust-bors bot added a commit that referenced this pull request
minimal dirfd implementation (1/4)
try-job: aarch64-apple try-job: dist-various* try-job: test-various* try-job: x86_64-msvc* try-job: x86_64-mingw*
Looks like I need a try job to see if the error still exists.
@bors2 try
@Qelxiros: 🔑 Insufficient privileges: not in try users
This comment has been minimized.
rust-bors bot added a commit that referenced this pull request
minimal dirfd implementation (1/4)
try-job: aarch64-apple try-job: dist-various* try-job: test-various* try-job: x86_64-msvc-1 try-job: x86_64-mingw*
☀️ Try build successful (CI)
Build commit: b34b92d (b34b92dc58537d82f2e3477bddd7c9560f59aae5, parent: 8205e6b75ec656305ac235d4726d2c7a1ddcef14)
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
and removed S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
📌 Commit 1479928 has been approved by tgross35
It is now in the queue for this repository.
bors added S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
minimal dirfd implementation (1/4)
This is the first of four smaller PRs that will eventually be equivalent to rust-lang#139514.
A few notes:
- I renamed
newtoopenbecauseopen_dirtakes&selfand opens a subdirectory.- I also renamed
opentoopen_file.
- I also renamed
- I'm not sure how to
impl AsRawFdand friends because thecommonimplementation usesPathBufs. How should I proceed here?
The other PRs will be based on this one, so I'll make drafts and mark them ready as their predecessors get merged. They might take a bit though; I've never done this particular thing with git before.
Tracking issue: rust-lang#120426
try-job: aarch64-apple try-job: dist-various* try-job: test-various* try-job: x86_64-msvc-1 try-job: x86_64-mingw*
bors added a commit that referenced this pull request
Rollup of 7 pull requests
Successful merges:
- #146341 (minimal dirfd implementation (1/4))
- #146925 (Add doc for va_list APIs)
- #147035 (alloc: fix
Debugimplementation ofExtractIf) - #147173 (Add support for hexagon-unknown-qurt target)
- #149041 (ignore unsized types in mips64 and sparc64 callconvs)
- #149056 (fix the fragment_in_dst_padding_gets_overwritten test on s390x)
- #149095 (rustc-dev-guide subtree update)
r? @ghost
@rustbot modify labels: rollup
bors added S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
labels
This comment has been minimized.
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.
Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.
The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
Labels
Operating system: Windows
Status: This is awaiting some action (such as code changes or more information) from the author.
Relevant to the library team, which will review and decide on the PR/issue.