Skip to content
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

Remove Linux workarounds for missing CLOEXEC support #74606

Merged
merged 2 commits into from
Jul 23, 2020

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Jul 21, 2020

Now that #74163 updated the minimum Linux kernel to 2.6.32, we can
assume the availability of APIs that open file descriptors that are
already set to close on exec, including the flags O_CLOEXEC,
SOCK_CLOEXEC, and F_DUPFD_CLOEXEC.

Closes #74519.

Now that rust-lang#74163 updated the minimum Linux kernel to 2.6.32, we can
assume the availability of APIs that open file descriptors that are
already set to close on exec, including the flags `O_CLOEXEC`,
`SOCK_CLOEXEC`, and `F_DUPFD_CLOEXEC`.
@rust-highfive
Copy link
Collaborator

r? @withoutboats

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 21, 2020
@withoutboats
Copy link
Contributor

@bors r? @sfackler

// supported (the third parameter, 0, is always valid), so we stop
// trying that.
//
// Also note that Android doesn't have F_DUPFD_CLOEXEC, but get it to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this note about android not relevant anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think at the time that flag wasn't in Android's headers, but the implementation details for fcntl are all handled in the kernel anyway. AFAICT 2.6.24 is older than any Android kernel that ever shipped.

The libc crate moved the Linux definition of the flag to include Android in rust-lang/libc@b43118c.

// There are a variety of `#[cfg]`s controlling which targets are involved in
// each instance of `weak!` and `syscall!`. Rather than trying to unify all of
// that, we'll just allow that some unix targets don't use this module at all.
#![allow(dead_code, unused_macros)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit unfortunate, but probably cleaner than trying to figure out the exact cfg needed.

@sfackler
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 23, 2020

📌 Commit ae06e13 has been approved by sfackler

@bors
Copy link
Contributor

bors commented Jul 23, 2020

🌲 The tree is currently closed for pull requests below priority 5, this pull request will be tested once the tree is reopened

@bors 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 Jul 23, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 23, 2020
…arth

Rollup of 8 pull requests

Successful merges:

 - rust-lang#74141 (libstd/libcore: fix various typos)
 - rust-lang#74490 (add a Backtrace::disabled function)
 - rust-lang#74548 (one more Path::with_extension example, to demonstrate behavior)
 - rust-lang#74587 (Prefer constant over function)
 - rust-lang#74606 (Remove Linux workarounds for missing CLOEXEC support)
 - rust-lang#74637 (Make str point to primitive page)
 - rust-lang#74654 (require type defaults to be after const generic parameters)
 - rust-lang#74659 (Improve codegen for unchecked float casts on wasm)

Failed merges:

r? @ghost
@bors bors merged commit 8909ac9 into rust-lang:master Jul 23, 2020
@cuviper cuviper deleted the cloexec branch August 9, 2020 23:36
sunfishcode added a commit to bytecodealliance/cap-std that referenced this pull request Aug 20, 2021
Rust itself has updated its minimum supported versison to
2.6.32 [here](rust-lang/rust#74606).

Fixes #85.
sunfishcode added a commit to bytecodealliance/cap-std that referenced this pull request Aug 20, 2021
Rust itself has updated its minimum supported versison to
2.6.32 [here](rust-lang/rust#74606).

Fixes #85.
sunfishcode added a commit to bytecodealliance/cap-std that referenced this pull request Aug 20, 2021
Rust itself has updated its minimum supported versison to
2.6.32 [here](rust-lang/rust#74606).

Fixes #85.
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
snev68 added a commit to snev68/cap-std that referenced this pull request Aug 5, 2024
Rust itself has updated its minimum supported versison to
2.6.32 [here](rust-lang/rust#74606).

Fixes #85.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean up some workarounds after upgrading minimum kernel version
5 participants