-
Notifications
You must be signed in to change notification settings - Fork 665
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
Enable fcntl OFD commands on macos #2300
Open
anacrolix
wants to merge
8
commits into
nix-rust:master
Choose a base branch
from
anacrolix:macos-ofd-fcntl
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2826537
Enable fcntl OFD commands on macos
anacrolix a8e2a33
clippy
anacrolix d17d271
Add missing libc feature for tests and use custom libc until merged
anacrolix 8011423
Update to rust version 1.71
anacrolix 85a6d5f
Add changelog
anacrolix 8ea5ddd
Bump MSRV in GitHub CI to 1.71
anacrolix 02b4802
libc feature const-extern-fn is needed regardless
anacrolix 395b17b
Update epoll flags due to libc change
anacrolix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ permissions: | |
contents: read | ||
|
||
env: | ||
MSRV: 1.69.0 | ||
MSRV: 1.71.0 | ||
|
||
jobs: | ||
|
||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Enable fcntl::{F_OFD_SETLKW,F_OFD_SETLK,F_OFD_GETLK} for macOS |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Use resolver "2" | ||
Require rust version 1.71 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Fix libc feature deps for testing (added "const-extern-fn") | ||
Fixed numerous clippy warnings |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ use std::mem; | |
use std::os::unix::io::{AsFd, AsRawFd, FromRawFd, OwnedFd, RawFd}; | ||
|
||
libc_bitflags!( | ||
pub struct EpollFlags: c_int { | ||
pub struct EpollFlags: u32 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, another type change: rust-lang/libc#3466 |
||
EPOLLIN; | ||
EPOLLPRI; | ||
EPOLLOUT; | ||
|
@@ -62,7 +62,7 @@ impl EpollEvent { | |
} | ||
|
||
pub fn events(&self) -> EpollFlags { | ||
EpollFlags::from_bits(self.event.events as c_int).unwrap() | ||
EpollFlags::from_bits(self.event.events as u32).unwrap() | ||
} | ||
|
||
pub fn data(&self) -> u64 { | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ use crate::errno::Errno; | |
use crate::sys::time::{TimeSpec, TimeVal}; | ||
use crate::Result; | ||
use libc::{self, c_int}; | ||
use std::convert::TryFrom; | ||
use std::iter::FusedIterator; | ||
use std::mem; | ||
use std::ops::Range; | ||
|
@@ -21,10 +20,7 @@ pub struct FdSet<'fd> { | |
} | ||
|
||
fn assert_fd_valid(fd: RawFd) { | ||
assert!( | ||
usize::try_from(fd).map_or(false, |fd| fd < FD_SETSIZE), | ||
"fd must be in the range 0..FD_SETSIZE", | ||
); | ||
assert!(fd < FD_SETSIZE, "fd must be in the range 0..FD_SETSIZE",); | ||
} | ||
|
||
impl<'fd> FdSet<'fd> { | ||
|
@@ -110,7 +106,7 @@ impl<'fd> FdSet<'fd> { | |
pub fn fds(&self, highest: Option<RawFd>) -> Fds { | ||
Fds { | ||
set: self, | ||
range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE), | ||
range: 0..highest.map(|h| h + 1).unwrap_or(FD_SETSIZE) as usize, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting, they changed the type of this constant from |
||
} | ||
} | ||
} | ||
|
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
It seems that this is already enabled since we are using Rust 2021?