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

Tweak the #[cfg()] statements in sys/ioctl/linux a little #2104

Merged
merged 2 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
TOOL: cargo
MSRV: 1.63.0
MSRV: 1.65.0
ZFLAGS:

# Tests that don't require executing the build binaries
Expand Down Expand Up @@ -137,7 +137,7 @@ task:
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
- sh rustup.sh -y --profile=minimal --default-toolchain $MSRV
- . $HOME/.cargo/env
- cargo install cross --version 0.2.1 # cross 0.2.2 bumped the MSRV to 1.58.1
- cargo install cross --version 0.2.5
<< : *TEST
before_cache_script: rm -rf $CARGO_HOME/registry/index

Expand All @@ -146,7 +146,7 @@ task:
matrix:
- name: Linux aarch64
arm_container:
image: rust:1.63.0
image: rust:1.65.0
cpu: 1
depends_on:
- FreeBSD 14 amd64 & i686
Expand All @@ -160,13 +160,13 @@ task:
TARGET: aarch64-unknown-linux-gnu
- name: Linux x86_64
container:
image: rust:1.63.0
image: rust:1.65.0
cpu: 1
env:
TARGET: x86_64-unknown-linux-gnu
- name: Linux x86_64 musl
container:
image: rust:1.63.0
image: rust:1.65.0
cpu: 1
depends_on:
- FreeBSD 14 amd64 & i686
Expand Down Expand Up @@ -199,7 +199,7 @@ task:
# Tasks for cross-compiling, but no testing
task:
container:
image: rust:1.63.0
image: rust:1.65.0
cpu: 1
depends_on:
- FreeBSD 14 amd64 & i686
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Changed

- The MSRV is now 1.63
- The MSRV is now 1.65
([#1862](https://github.com/nix-rust/nix/pull/1862))
([#2104](https://github.com/nix-rust/nix/pull/2104))
- The epoll interface now uses a type.
([#1882](https://github.com/nix-rust/nix/pull/1882))
- With I/O-safe type applied in `pty::OpenptyResult` and `pty::ForkptyResult`,
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "nix"
description = "Rust friendly bindings to *nix APIs"
edition = "2021"
version = "0.26.1"
rust-version = "1.63"
rust-version = "1.65"
authors = ["The nix-rust Project Developers"]
repository = "https://github.com/nix-rust/nix"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ The following targets are supported by `nix`:

## Minimum Supported Rust Version (MSRV)

nix is supported on Rust 1.63 and higher. Its MSRV will not be
nix is supported on Rust 1.65 and higher. Its MSRV will not be
changed in the future without bumping the major or minor version.

## Contributing
Expand Down
79 changes: 37 additions & 42 deletions src/sys/ioctl/linux.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use cfg_if::cfg_if;

/// The datatype used for the ioctl number
#[cfg(any(target_os = "android", target_env = "musl"))]
#[doc(hidden)]
Expand All @@ -14,48 +16,41 @@ pub const NRBITS: ioctl_num_type = 8;
#[doc(hidden)]
pub const TYPEBITS: ioctl_num_type = 8;

#[cfg(any(
target_arch = "mips",
target_arch = "mips64",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "sparc64"
))]
mod consts {
#[doc(hidden)]
pub const NONE: u8 = 1;
#[doc(hidden)]
pub const READ: u8 = 2;
#[doc(hidden)]
pub const WRITE: u8 = 4;
#[doc(hidden)]
pub const SIZEBITS: u8 = 13;
#[doc(hidden)]
pub const DIRBITS: u8 = 3;
}

// "Generic" ioctl protocol
#[cfg(any(
target_arch = "x86",
target_arch = "arm",
target_arch = "s390x",
target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "riscv32",
target_arch = "riscv64",
target_arch = "loongarch64"
))]
mod consts {
#[doc(hidden)]
pub const NONE: u8 = 0;
#[doc(hidden)]
pub const READ: u8 = 2;
#[doc(hidden)]
pub const WRITE: u8 = 1;
#[doc(hidden)]
pub const SIZEBITS: u8 = 14;
#[doc(hidden)]
pub const DIRBITS: u8 = 2;
cfg_if! {
if #[cfg(any(
target_arch = "mips",
target_arch = "mips64",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "sparc64"
))] {
mod consts {
#[doc(hidden)]
pub const NONE: u8 = 1;
#[doc(hidden)]
pub const READ: u8 = 2;
#[doc(hidden)]
pub const WRITE: u8 = 4;
#[doc(hidden)]
pub const SIZEBITS: u8 = 13;
#[doc(hidden)]
pub const DIRBITS: u8 = 3;
}
} else {
// "Generic" ioctl protocol
mod consts {
#[doc(hidden)]
pub const NONE: u8 = 0;
#[doc(hidden)]
pub const READ: u8 = 2;
#[doc(hidden)]
pub const WRITE: u8 = 1;
#[doc(hidden)]
pub const SIZEBITS: u8 = 14;
#[doc(hidden)]
pub const DIRBITS: u8 = 2;
}
}
}

pub use self::consts::*;
Expand Down