Skip to content

Commit db3e036

Browse files
committed
Remove newer libc changes that aren't necessary anymore
1 parent 1881025 commit db3e036

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ permissions:
1313
contents: read
1414

1515
env:
16-
MSRV: 1.71.0
16+
MSRV: 1.69.0
1717
# Rust's Loongarch support merged in 1.71.0
1818
MSRV_LOONGARCH: 1.71.0
1919
# Minimal Rust version to support all 3 official OpenHarmony targets as tier2

Cargo.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
name = "nix"
33
description = "Rust friendly bindings to *nix APIs"
44
edition = "2021"
5-
resolver = "2"
65
version = "0.30.1"
7-
rust-version = "1.71"
6+
rust-version = "1.69"
87
authors = ["The nix-rust Project Developers"]
98
repository = "https://github.com/nix-rust/nix"
109
license = "MIT"
@@ -29,6 +28,7 @@ targets = [
2928
]
3029

3130
[dependencies]
31+
libc = { version = "=0.2.172", features = ["extra_traits"] }
3232
bitflags = "2.3.3"
3333
cfg-if = "1.0"
3434
pin-utils = { version = "0.1.0", optional = true }
@@ -72,10 +72,6 @@ uio = []
7272
user = ["feature"]
7373
zerocopy = ["fs", "uio"]
7474

75-
[dependencies.libc]
76-
version = "0.2.172"
77-
features = ["extra_traits", "const-extern-fn"]
78-
7975
[dev-dependencies]
8076
assert-impl = "0.1"
8177
parking_lot = "0.12"

src/sys/epoll.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::mem;
77
use std::os::unix::io::{AsFd, AsRawFd, FromRawFd, OwnedFd, RawFd};
88

99
libc_bitflags!(
10-
pub struct EpollFlags: u32 {
10+
pub struct EpollFlags: c_int {
1111
EPOLLIN;
1212
EPOLLPRI;
1313
EPOLLOUT;
@@ -63,7 +63,7 @@ impl EpollEvent {
6363
}
6464

6565
pub fn events(&self) -> EpollFlags {
66-
EpollFlags::from_bits(self.event.events as u32).unwrap()
66+
EpollFlags::from_bits(self.event.events as c_int).unwrap()
6767
}
6868

6969
pub const fn data(&self) -> u64 {

src/sys/select.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ pub struct FdSet<'fd> {
2020
}
2121

2222
fn assert_fd_valid(fd: RawFd) {
23-
assert!(fd < FD_SETSIZE, "fd must be in the range 0..FD_SETSIZE",);
23+
assert!(
24+
usize::try_from(fd).map_or(false, |fd| fd < FD_SETSIZE),
25+
"fd must be in the range 0..FD_SETSIZE",
26+
);
2427
}
2528

2629
impl<'fd> FdSet<'fd> {
@@ -106,7 +109,7 @@ impl<'fd> FdSet<'fd> {
106109
pub fn fds(&self, highest: Option<RawFd>) -> Fds<'_, '_> {
107110
Fds {
108111
set: self,
109-
range: 0..highest.map(|h| h + 1).unwrap_or(FD_SETSIZE) as usize,
112+
range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE),
110113
}
111114
}
112115
}

0 commit comments

Comments
 (0)