-
Notifications
You must be signed in to change notification settings - Fork 682
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
base: master
Are you sure you want to change the base?
Changes from all commits
2826537
a8e2a33
d17d271
8011423
85a6d5f
8ea5ddd
02b4802
395b17b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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: | ||
|
||
|
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Use resolver "2" | ||
Require rust version 1.71 |
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 |
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 { | ||
|
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 |
||
} | ||
} | ||
} | ||
|
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?