From 327d132aac2036db5828a22f3d1cdd06038f3397 Mon Sep 17 00:00:00 2001 From: Sertonix Date: Tue, 28 Oct 2025 17:47:31 +0100 Subject: [PATCH] rust/pvcore/uvdevice: Fix compilation on musl libc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit musl libc ioctl uses int instead of unsigned long. Github-ID: https://github.com/ibm-s390-linux/s390-tools/pull/193 Signed-off-by: Sertonix Reviewed-by: Steffen Eiden Reviewed-by: Jan Höppner Signed-off-by: Jan Höppner --- rust/pv_core/src/uvdevice.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rust/pv_core/src/uvdevice.rs b/rust/pv_core/src/uvdevice.rs index de17f3cf..b8dcec23 100644 --- a/rust/pv_core/src/uvdevice.rs +++ b/rust/pv_core/src/uvdevice.rs @@ -8,7 +8,6 @@ use crate::{Error, Result}; use log::debug; use std::{ convert::TryInto, - ffi::c_ulong, fs::File, os::unix::prelude::{AsRawFd, RawFd}, }; @@ -46,7 +45,7 @@ pub type UvFlags = crate::misc::Msb0Flags64; /// /// # Safety: /// Raw fd must point to an open file -fn ioctl_raw(raw_fd: RawFd, cmd: c_ulong, cb: &mut IoctlCb) -> Result<()> { +fn ioctl_raw(raw_fd: RawFd, cmd: u64, cb: &mut IoctlCb) -> Result<()> { debug!("calling unsafe fn wrapper uv::ioctl_raw with {raw_fd:#x?}, {cmd:#x?}, {cb:?}"); let rc; @@ -56,7 +55,7 @@ fn ioctl_raw(raw_fd: RawFd, cmd: c_ulong, cb: &mut IoctlCb) -> Result<()> { // SAFETY: the passed pointer points to a valid memory region that // contains the expected C-struct. The struct outlives this function. unsafe { - rc = ioctl(raw_fd, cmd, cb.as_ptr_mut()); + rc = ioctl(raw_fd, cmd.try_into().unwrap(), cb.as_ptr_mut()); } // NOTE io::Error handles all errnos ioctl uses