update nix to 0.26

it's the version currently shipped by bookworm, so let's unify this widely-used
dependency to make bootstrapping easier.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2023-01-05 11:16:50 +01:00
parent 6953154254
commit ff9aa2012e
7 changed files with 18 additions and 14 deletions

View File

@ -50,7 +50,7 @@ hyper = "0.14.5"
lazy_static = "1.4"
libc = "0.2.107"
log = "0.4.17"
nix = "0.24.1"
nix = "0.26.1"
once_cell = "1.3.1"
openssl = "0.10"
percent-encoding = "2.1"

View File

@ -15,7 +15,7 @@ Build-Depends: debhelper (>= 12),
librust-lazy-static-1+default-dev (>= 1.4-~~) <!nocheck>,
librust-libc-0.2+default-dev (>= 0.2.107-~~) <!nocheck>,
librust-log-0.4+default-dev (>= 0.4.17-~~) <!nocheck>,
librust-nix-0.24+default-dev (>= 0.24.1-~~) <!nocheck>,
librust-nix-0.26+default-dev (>= 0.26.1-~~) <!nocheck>,
librust-once-cell-1+default-dev (>= 1.3.1-~~) <!nocheck>,
librust-percent-encoding-2+default-dev (>= 2.1-~~) <!nocheck>,
librust-proxmox-async-0.4+default-dev (>= 0.4.1-~~) <!nocheck>,
@ -64,7 +64,7 @@ Depends:
librust-lazy-static-1+default-dev (>= 1.4-~~),
librust-libc-0.2+default-dev (>= 0.2.107-~~),
librust-log-0.4+default-dev (>= 0.4.17-~~),
librust-nix-0.24+default-dev (>= 0.24.1-~~),
librust-nix-0.26+default-dev (>= 0.26.1-~~),
librust-once-cell-1+default-dev (>= 1.3.1-~~),
librust-percent-encoding-2+default-dev (>= 2.1-~~),
librust-proxmox-async-0.4+default-dev (>= 0.4.1-~~),

View File

@ -12,7 +12,7 @@ Build-Depends: debhelper (>= 12),
librust-hyper-0.14+default-dev (>= 0.14.5-~~) <!nocheck>,
librust-hyper-0.14+full-dev (>= 0.14.5-~~) <!nocheck>,
librust-libc-0.2+default-dev (>= 0.2.107-~~) <!nocheck>,
librust-nix-0.24+default-dev (>= 0.24.1-~~) <!nocheck>,
librust-nix-0.26+default-dev (>= 0.26.1-~~) <!nocheck>,
librust-percent-encoding-2+default-dev (>= 2.1-~~) <!nocheck>,
librust-proxmox-async-0.4+default-dev (>= 0.4.1-~~) <!nocheck>,
librust-proxmox-lang-1+default-dev (>= 1.1-~~) <!nocheck>,
@ -35,7 +35,7 @@ Multi-Arch: same
Depends:
${misc:Depends},
librust-anyhow-1+default-dev,
librust-nix-0.24+default-dev (>= 0.24.1-~~),
librust-nix-0.26+default-dev (>= 0.26.1-~~),
librust-percent-encoding-2+default-dev (>= 2.1-~~),
librust-proxmox-async-0.4+default-dev (>= 0.4.1-~~),
librust-proxmox-lang-1+default-dev (>= 1.1-~~),

View File

@ -71,7 +71,7 @@ Depends:
${misc:Depends},
librust-proxmox-schema-dev (= ${binary:Version}),
librust-libc-0.2+default-dev (>= 0.2.107-~~),
librust-nix-0.24+default-dev (>= 0.24.1-~~)
librust-nix-0.26+default-dev (>= 0.26.1-~~)
Provides:
librust-proxmox-schema-1+upid-api-impl-dev (= ${binary:Version}),
librust-proxmox-schema-1.3+upid-api-impl-dev (= ${binary:Version}),

View File

@ -8,7 +8,7 @@ Build-Depends: debhelper (>= 12),
libstd-rust-dev <!nocheck>,
librust-anyhow-1+default-dev <!nocheck>,
librust-libc-0.2+default-dev (>= 0.2.107-~~) <!nocheck>,
librust-nix-0.24+default-dev (>= 0.24.1-~~) <!nocheck>,
librust-nix-0.26+default-dev (>= 0.26.1-~~) <!nocheck>,
librust-proxmox-sys-0.4+default-dev (>= 0.4.1-~~) <!nocheck>
Maintainer: Proxmox Support Team <support@proxmox.com>
Standards-Version: 4.6.1
@ -24,7 +24,7 @@ Depends:
${misc:Depends},
librust-anyhow-1+default-dev,
librust-libc-0.2+default-dev (>= 0.2.107-~~),
librust-nix-0.24+default-dev (>= 0.24.1-~~),
librust-nix-0.26+default-dev (>= 0.26.1-~~),
librust-proxmox-sys-0.4+default-dev (>= 0.4.1-~~)
Provides:
librust-proxmox-shared-memory+default-dev (= ${binary:Version}),

View File

@ -11,7 +11,7 @@ Build-Depends: debhelper (>= 12),
librust-lazy-static-1+default-dev (>= 1.4-~~) <!nocheck>,
librust-libc-0.2+default-dev (>= 0.2.107-~~) <!nocheck>,
librust-log-0.4+default-dev (>= 0.4.17-~~) <!nocheck>,
librust-nix-0.24+default-dev (>= 0.24.1-~~) <!nocheck>,
librust-nix-0.26+default-dev (>= 0.26.1-~~) <!nocheck>,
librust-proxmox-io-1+default-dev <!nocheck>,
librust-proxmox-lang-1+default-dev (>= 1.1-~~) <!nocheck>,
librust-proxmox-time-1+default-dev (>= 1.1.4-~~) <!nocheck>,
@ -38,7 +38,7 @@ Depends:
librust-lazy-static-1+default-dev (>= 1.4-~~),
librust-libc-0.2+default-dev (>= 0.2.107-~~),
librust-log-0.4+default-dev (>= 0.4.17-~~),
librust-nix-0.24+default-dev (>= 0.24.1-~~),
librust-nix-0.26+default-dev (>= 0.26.1-~~),
librust-proxmox-io-1+default-dev,
librust-proxmox-lang-1+default-dev (>= 1.1-~~),
librust-proxmox-time-1+default-dev (>= 1.1.4-~~),

View File

@ -2,9 +2,11 @@
use std::convert::TryFrom;
use std::mem::MaybeUninit;
use std::num::NonZeroUsize;
use std::os::unix::io::RawFd;
use std::{io, mem, ptr};
use std::{io, mem};
use anyhow::format_err;
use nix::sys::mman;
use proxmox_lang::error::io_err_other;
@ -32,12 +34,14 @@ impl<T> Mmap<T> {
prot: mman::ProtFlags,
flags: mman::MapFlags,
) -> io::Result<Self> {
let byte_len = count * mem::size_of::<T>();
let byte_len = NonZeroUsize::new(count * mem::size_of::<T>())
.ok_or(io_err_other(format_err!("mapped length must not be zero")))?;
// libc::size_t vs usize
#[allow(clippy::useless_conversion)]
let data = mman::mmap(
ptr::null_mut(),
libc::size_t::try_from(byte_len).map_err(io_err_other)?,
None,
byte_len,
prot,
flags,
fd,