Skip to content

Commit

Permalink
Tweak the #[cfg()] statements in sys/ioctl/linux a little (nix-rust#2104
Browse files Browse the repository at this point in the history
)

* 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.
  • Loading branch information
asomers authored and Dirreke committed Sep 16, 2023
1 parent 08d8ba9 commit 4838570
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 51 deletions.
41 changes: 34 additions & 7 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.56.1
MSRV: 1.65.0
ZFLAGS:

# Tests that don't require executing the build binaries
Expand Down Expand Up @@ -133,8 +133,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 --locked # cross 0.2.2 bumped the MSRV to 1.58.1
- cp Cargo.lock.msrv Cargo.lock
- cargo install cross --version 0.2.5
<< : *TEST
before_cache_script: rm -rf $CARGO_HOME/registry/index

Expand All @@ -143,17 +142,36 @@ task:
matrix:
- name: Linux aarch64
arm_container:
image: rust:1.56
image: rust:1.65.0
cpu: 1
depends_on:
- FreeBSD 14 amd64 & i686
- Linux x86_64
- macOS aarch64
- Rust Formatter
- OpenBSD x86_64
- Minver
- Rust Stable
env:
TARGET: aarch64-unknown-linux-gnu
- name: Linux x86_64
container:
image: rust:1.56
image: rust:1.65.0
cpu: 1
env:
TARGET: x86_64-unknown-linux-gnu
- name: Linux x86_64 musl
container:
image: rust:1.56
image: rust:1.65.0
cpu: 1
depends_on:
- FreeBSD 14 amd64 & i686
- Linux x86_64
- macOS aarch64
- Rust Formatter
- OpenBSD x86_64
- Minver
- Rust Stable
env:
TARGET: x86_64-unknown-linux-musl
setup_script:
Expand All @@ -177,7 +195,16 @@ task:
# Tasks for cross-compiling, but no testing
task:
container:
image: rust:1.56
image: rust:1.65.0
cpu: 1
depends_on:
- FreeBSD 14 amd64 & i686
- Linux x86_64
- macOS aarch64
- Rust Formatter
- OpenBSD x86_64
- Minver
- Rust Stable
env:
BUILD: check
HOST: x86_64-unknown-linux-gnu
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- Fixed an unintended API change in release 0.26.3, due to the upgrade of the
bitflags dependency.
([#2117](https://github.com/nix-rust/nix/pull/2117))
- 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`,
users no longer need to manually close the file descriptors in these types.
([#1921](https://github.com/nix-rust/nix/pull/1921))
- `sys::event::{kevent, kevent_ts}` are deprecated in favor of
`sys::kevent::Kqueue::kevent`, and `sys::event::kqueue` is deprecated in
favor of `sys::kevent::Kqueue::new`.
([#1943](https://github.com/nix-rust/nix/pull/1943))
- `nix::socket` and `nix::select` are now available on Redox.
([#2012](https://github.com/nix-rust/nix/pull/2012))
- All features have been removed from the default set. Users will need to specify
which features they depend on in their Cargo.toml.
([#2091](https://github.com/nix-rust/nix/pull/2091))

## [0.26.3] - 2023-08-27

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "nix"
description = "Rust friendly bindings to *nix APIs"
edition = "2018"
edition = "2021"
version = "0.26.4"
rust-version = "1.56"
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 @@ -89,7 +89,7 @@ Tier 3:

## Minimum Supported Rust Version (MSRV)

nix is supported on Rust 1.56.1 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
78 changes: 37 additions & 41 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,47 +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"
))]
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

0 comments on commit 4838570

Please sign in to comment.