Skip to content

Commit 4838570

Browse files
asomersDirreke
authored andcommitted
Tweak the #[cfg()] statements in sys/ioctl/linux a little (nix-rust#2104)
* Tweak the #[cfg()] statements in sys/ioctl/linux a little This should give Nix a better chance of building on architectures that aren't specifically-supported. * Raise MSRV to 1.65.0 Because cross now requires that through a transitive dependency. I don't know how to install cross for CI with a lower Rust version.
1 parent 08d8ba9 commit 4838570

File tree

5 files changed

+91
-51
lines changed

5 files changed

+91
-51
lines changed

.cirrus.yml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99
RUSTFLAGS: -D warnings
1010
RUSTDOCFLAGS: -D warnings
1111
TOOL: cargo
12-
MSRV: 1.56.1
12+
MSRV: 1.65.0
1313
ZFLAGS:
1414

1515
# Tests that don't require executing the build binaries
@@ -133,8 +133,7 @@ task:
133133
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
134134
- sh rustup.sh -y --profile=minimal --default-toolchain $MSRV
135135
- . $HOME/.cargo/env
136-
- cargo install cross --version 0.2.1 --locked # cross 0.2.2 bumped the MSRV to 1.58.1
137-
- cp Cargo.lock.msrv Cargo.lock
136+
- cargo install cross --version 0.2.5
138137
<< : *TEST
139138
before_cache_script: rm -rf $CARGO_HOME/registry/index
140139

@@ -143,17 +142,36 @@ task:
143142
matrix:
144143
- name: Linux aarch64
145144
arm_container:
146-
image: rust:1.56
145+
image: rust:1.65.0
146+
cpu: 1
147+
depends_on:
148+
- FreeBSD 14 amd64 & i686
149+
- Linux x86_64
150+
- macOS aarch64
151+
- Rust Formatter
152+
- OpenBSD x86_64
153+
- Minver
154+
- Rust Stable
147155
env:
148156
TARGET: aarch64-unknown-linux-gnu
149157
- name: Linux x86_64
150158
container:
151-
image: rust:1.56
159+
image: rust:1.65.0
160+
cpu: 1
152161
env:
153162
TARGET: x86_64-unknown-linux-gnu
154163
- name: Linux x86_64 musl
155164
container:
156-
image: rust:1.56
165+
image: rust:1.65.0
166+
cpu: 1
167+
depends_on:
168+
- FreeBSD 14 amd64 & i686
169+
- Linux x86_64
170+
- macOS aarch64
171+
- Rust Formatter
172+
- OpenBSD x86_64
173+
- Minver
174+
- Rust Stable
157175
env:
158176
TARGET: x86_64-unknown-linux-musl
159177
setup_script:
@@ -177,7 +195,16 @@ task:
177195
# Tasks for cross-compiling, but no testing
178196
task:
179197
container:
180-
image: rust:1.56
198+
image: rust:1.65.0
199+
cpu: 1
200+
depends_on:
201+
- FreeBSD 14 amd64 & i686
202+
- Linux x86_64
203+
- macOS aarch64
204+
- Rust Formatter
205+
- OpenBSD x86_64
206+
- Minver
207+
- Rust Stable
181208
env:
182209
BUILD: check
183210
HOST: x86_64-unknown-linux-gnu

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1010
- Fixed an unintended API change in release 0.26.3, due to the upgrade of the
1111
bitflags dependency.
1212
([#2117](https://github.com/nix-rust/nix/pull/2117))
13+
- The MSRV is now 1.65
14+
([#1862](https://github.com/nix-rust/nix/pull/1862))
15+
([#2104](https://github.com/nix-rust/nix/pull/2104))
16+
- The epoll interface now uses a type.
17+
([#1882](https://github.com/nix-rust/nix/pull/1882))
18+
- With I/O-safe type applied in `pty::OpenptyResult` and `pty::ForkptyResult`,
19+
users no longer need to manually close the file descriptors in these types.
20+
([#1921](https://github.com/nix-rust/nix/pull/1921))
21+
- `sys::event::{kevent, kevent_ts}` are deprecated in favor of
22+
`sys::kevent::Kqueue::kevent`, and `sys::event::kqueue` is deprecated in
23+
favor of `sys::kevent::Kqueue::new`.
24+
([#1943](https://github.com/nix-rust/nix/pull/1943))
25+
- `nix::socket` and `nix::select` are now available on Redox.
26+
([#2012](https://github.com/nix-rust/nix/pull/2012))
27+
- All features have been removed from the default set. Users will need to specify
28+
which features they depend on in their Cargo.toml.
29+
([#2091](https://github.com/nix-rust/nix/pull/2091))
1330

1431
## [0.26.3] - 2023-08-27
1532

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "nix"
33
description = "Rust friendly bindings to *nix APIs"
4-
edition = "2018"
4+
edition = "2021"
55
version = "0.26.4"
6-
rust-version = "1.56"
6+
rust-version = "1.65"
77
authors = ["The nix-rust Project Developers"]
88
repository = "https://github.com/nix-rust/nix"
99
license = "MIT"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Tier 3:
8989

9090
## Minimum Supported Rust Version (MSRV)
9191

92-
nix is supported on Rust 1.56.1 and higher. Its MSRV will not be
92+
nix is supported on Rust 1.65 and higher. Its MSRV will not be
9393
changed in the future without bumping the major or minor version.
9494

9595
## Contributing

src/sys/ioctl/linux.rs

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use cfg_if::cfg_if;
2+
13
/// The datatype used for the ioctl number
24
#[cfg(any(target_os = "android", target_env = "musl"))]
35
#[doc(hidden)]
@@ -14,47 +16,41 @@ pub const NRBITS: ioctl_num_type = 8;
1416
#[doc(hidden)]
1517
pub const TYPEBITS: ioctl_num_type = 8;
1618

17-
#[cfg(any(
18-
target_arch = "mips",
19-
target_arch = "mips64",
20-
target_arch = "powerpc",
21-
target_arch = "powerpc64",
22-
target_arch = "sparc64"
23-
))]
24-
mod consts {
25-
#[doc(hidden)]
26-
pub const NONE: u8 = 1;
27-
#[doc(hidden)]
28-
pub const READ: u8 = 2;
29-
#[doc(hidden)]
30-
pub const WRITE: u8 = 4;
31-
#[doc(hidden)]
32-
pub const SIZEBITS: u8 = 13;
33-
#[doc(hidden)]
34-
pub const DIRBITS: u8 = 3;
35-
}
36-
37-
// "Generic" ioctl protocol
38-
#[cfg(any(
39-
target_arch = "x86",
40-
target_arch = "arm",
41-
target_arch = "s390x",
42-
target_arch = "x86_64",
43-
target_arch = "aarch64",
44-
target_arch = "riscv32",
45-
target_arch = "riscv64"
46-
))]
47-
mod consts {
48-
#[doc(hidden)]
49-
pub const NONE: u8 = 0;
50-
#[doc(hidden)]
51-
pub const READ: u8 = 2;
52-
#[doc(hidden)]
53-
pub const WRITE: u8 = 1;
54-
#[doc(hidden)]
55-
pub const SIZEBITS: u8 = 14;
56-
#[doc(hidden)]
57-
pub const DIRBITS: u8 = 2;
19+
cfg_if! {
20+
if #[cfg(any(
21+
target_arch = "mips",
22+
target_arch = "mips64",
23+
target_arch = "powerpc",
24+
target_arch = "powerpc64",
25+
target_arch = "sparc64"
26+
))] {
27+
mod consts {
28+
#[doc(hidden)]
29+
pub const NONE: u8 = 1;
30+
#[doc(hidden)]
31+
pub const READ: u8 = 2;
32+
#[doc(hidden)]
33+
pub const WRITE: u8 = 4;
34+
#[doc(hidden)]
35+
pub const SIZEBITS: u8 = 13;
36+
#[doc(hidden)]
37+
pub const DIRBITS: u8 = 3;
38+
}
39+
} else {
40+
// "Generic" ioctl protocol
41+
mod consts {
42+
#[doc(hidden)]
43+
pub const NONE: u8 = 0;
44+
#[doc(hidden)]
45+
pub const READ: u8 = 2;
46+
#[doc(hidden)]
47+
pub const WRITE: u8 = 1;
48+
#[doc(hidden)]
49+
pub const SIZEBITS: u8 = 14;
50+
#[doc(hidden)]
51+
pub const DIRBITS: u8 = 2;
52+
}
53+
}
5854
}
5955

6056
pub use self::consts::*;

0 commit comments

Comments
 (0)