Skip to content

Commit 7b84815

Browse files
vimprovedslp
authored andcommitted
Update nix to 0.30.1 to fix musl build
Currently muvm fails to build on musl due to getregs/setregs being missing from the nix crate on musl/aarch64. This was fixed in 0.30.0. As 0.30.0 also made unistd interfaces type-safe, this commit makes changes accordingly. Signed-off-by: Violet Purcell <[email protected]>
1 parent 8790902 commit 7b84815

4 files changed

Lines changed: 24 additions & 12 deletions

File tree

Cargo.lock

Lines changed: 17 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/muvm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ input-linux = { version = "0.7.0", default-features = false, features = [] }
1818
input-linux-sys = { version = "0.9.0", default-features = false, features = [] }
1919
krun-sys = { path = "../krun-sys", version = "1.9.1", default-features = false, features = [] }
2020
log = { version = "0.4.21", default-features = false, features = ["kv"] }
21-
nix = { version = "0.29.0", default-features = false, features = ["event", "fs", "ioctl", "mman", "ptrace", "signal", "socket", "uio", "user"] }
21+
nix = { version = "0.30.0", default-features = false, features = ["event", "fs", "ioctl", "mman", "ptrace", "signal", "socket", "uio", "user"] }
2222
neli = { version = "0.7.0-rc3", default-features = false, features = ["sync"] }
2323
procfs = { version = "0.17.0", default-features = false, features = [] }
2424
rustix = { version = "0.38.34", default-features = false, features = ["fs", "mount", "process", "pty", "std", "stdio", "system", "termios", "use-libc-auxv"] }

crates/muvm/src/guest/bridge/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ impl<'a, P: ProtocolHandler> Client<'a, P> {
710710
fn process_vgpu(&mut self) -> Result<bool> {
711711
let mut evt = DrmEvent::default();
712712
// SAFETY: `read` will return a valid DrmEvent
713-
read(self.gpu_ctx.fd.as_raw_fd(), unsafe {
713+
read(self.gpu_ctx.fd.as_fd(), unsafe {
714714
slice::from_raw_parts_mut(
715715
&mut evt as *mut DrmEvent as *mut u8,
716716
mem::size_of::<DrmEvent>(),

crates/muvm/src/guest/bridge/x11.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::collections::{HashMap, VecDeque};
33
use std::ffi::{c_long, c_void, CString};
44
use std::fs::{read_to_string, remove_file, File};
55
use std::io::{IoSlice, Write};
6-
use std::os::fd::{AsFd, AsRawFd, FromRawFd, OwnedFd, RawFd};
6+
use std::os::fd::{AsFd, AsRawFd, BorrowedFd, OwnedFd};
77
use std::process::exit;
88
use std::ptr::NonNull;
99
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
@@ -375,7 +375,7 @@ impl X11ProtocolHandler {
375375
}
376376

377377
fn replace_futex_storage(
378-
my_fd: RawFd,
378+
my_fd: BorrowedFd,
379379
pid: Pid,
380380
shmem_path: &str,
381381
shmem_file: &mut File,
@@ -392,7 +392,7 @@ impl X11ProtocolHandler {
392392
for entry in fs::read_dir(format!("/proc/{pid}/fd"))? {
393393
let entry = entry?;
394394
if let Ok(file) = File::options().open(entry.path()) {
395-
if fstat(file.as_raw_fd())?.st_ino == my_ino {
395+
if fstat(file.as_fd())?.st_ino == my_ino {
396396
fds_to_replace.push(entry.file_name().to_string_lossy().parse::<i32>()?);
397397
}
398398
}
@@ -461,9 +461,9 @@ impl X11ProtocolHandler {
461461
return Err(Errno::EOPNOTSUPP.into());
462462
} else {
463463
let (fd, shmem_path) = mkstemp(SHM_TEMPLATE)?;
464-
let mut shmem_file = unsafe { File::from_raw_fd(fd) };
464+
let mut shmem_file = File::from(fd);
465465
let ret = Self::replace_futex_storage(
466-
memfd.as_raw_fd(),
466+
memfd.as_fd(),
467467
Pid::from_raw(pid),
468468
shmem_path.as_os_str().to_str().unwrap(),
469469
&mut shmem_file,

0 commit comments

Comments
 (0)