-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add a try_clone()
function to OwnedFd
.
#88794
Conversation
As suggested in rust-lang#88564. This adds a `try_clone()` to `OwnedFd` by refactoring the code out of the existing `File`/`Socket` code.
This comment has been minimized.
This comment has been minimized.
@@ -266,22 +266,9 @@ impl FileDesc { | |||
} | |||
} | |||
|
|||
#[inline] | |||
pub fn duplicate(&self) -> io::Result<FileDesc> { |
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.
Long-term, I wonder if we can eliminate this internal interface in favor of try_clone. But that's not an issue for this PR.
LGTM. r=me when CI passes. |
This comment has been minimized.
This comment has been minimized.
The CI now passes; @joshtriplett I think this just needs an r+. |
LGTM @bors r+ As a follow-up, I think we should investigate whether we can drop the special-case handling of systems without |
📌 Commit 2d6a4c8 has been approved by |
…r=joshtriplett Add a `try_clone()` function to `OwnedFd`. As suggested in rust-lang#88564. This adds a `try_clone()` to `OwnedFd` by refactoring the code out of the existing `File`/`Socket` code. r? `@joshtriplett`
The compilation errors on WASI are now fixed. |
@joshtriplett This previously had a compilation error on WASI, which is now fixed. |
I've now fixed the error reported by bors. |
…r=joshtriplett Add a `try_clone()` function to `OwnedFd`. As suggested in rust-lang#88564. This adds a `try_clone()` to `OwnedFd` by refactoring the code out of the existing `File`/`Socket` code. r? ``@joshtriplett``
@bors r- |
`WSADuplicateSocketW` returns 0 on success, which differs from handle-oriented functions which return 0 on error. Use `sys::net::cvt` to handle its return value, which handles the socket convention of returning 0 on success, rather than `sys::cvt`, which handles the handle-oriented convention of returning 0 on failure.
The CI failure turned out to be that the code was calling |
@sunfishcode Good catch. That seems like a source of potential future bugs. Would you consider a separate PR to rename the socket-like one to @bors r+ |
📌 Commit 83aebf8 has been approved by |
…r=joshtriplett Add a `try_clone()` function to `OwnedFd`. As suggested in rust-lang#88564. This adds a `try_clone()` to `OwnedFd` by refactoring the code out of the existing `File`/`Socket` code. r? `@joshtriplett`
…askrgr Rollup of 8 pull requests Successful merges: - rust-lang#88794 (Add a `try_clone()` function to `OwnedFd`.) - rust-lang#93064 (Properly track `DepNode`s in trait evaluation provisional cache) - rust-lang#93118 (Move param count error emission to end of `check_argument_types`) - rust-lang#93144 (Work around missing code coverage data causing llvm-cov failures) - rust-lang#93169 (Fix inconsistency of local blanket impls) - rust-lang#93175 (Implement stable overlap check considering negative traits) - rust-lang#93251 (rustdoc settings: use radio buttons for theme) - rust-lang#93269 (Use error-on-mismatch policy for PAuth module flags.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Port std's `try_clone`, added in rust-lang/rust#88794, to io-lifetimes. This puts the actua clone logic under control of `feature = "close"`, as it has a similar circular dependency issue with rustix.
This corresponds to the `try_clone` function in sunfishcode/io-lifetimes#16 and rust-lang/rust#88794.
This corresponds to the `try_clone` function in sunfishcode/io-lifetimes#16 and rust-lang/rust#88794.
This corresponds to the `try_clone` function in sunfishcode/io-lifetimes#16 and rust-lang/rust#88794.
Port std's `try_clone`, added in rust-lang/rust#88794, to io-lifetimes. This puts the actua clone logic under control of `feature = "close"`, as it has a similar circular dependency issue with rustix.
This corresponds to the `try_clone` function in sunfishcode/io-lifetimes#16 and rust-lang/rust#88794.
As suggested in #88564. This adds a
try_clone()
toOwnedFd
byrefactoring the code out of the existing
File
/Socket
code.r? @joshtriplett