Skip to content

Commit a8a1952

Browse files
committed
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 ef920fb commit a8a1952

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
@@ -735,7 +735,7 @@ impl<'a, P: ProtocolHandler> Client<'a, P> {
735735
fn process_vgpu(&mut self) -> Result<bool> {
736736
let mut evt = DrmEvent::default();
737737
// SAFETY: `read` will return a valid DrmEvent
738-
read(self.gpu_ctx.fd.as_raw_fd(), unsafe {
738+
read(self.gpu_ctx.fd.as_fd(), unsafe {
739739
slice::from_raw_parts_mut(
740740
&mut evt as *mut DrmEvent as *mut u8,
741741
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};
@@ -371,7 +371,7 @@ impl X11ProtocolHandler {
371371
}
372372

373373
fn replace_futex_storage(
374-
my_fd: RawFd,
374+
my_fd: BorrowedFd,
375375
pid: Pid,
376376
shmem_path: &str,
377377
shmem_file: &mut File,
@@ -388,7 +388,7 @@ impl X11ProtocolHandler {
388388
for entry in fs::read_dir(format!("/proc/{pid}/fd"))? {
389389
let entry = entry?;
390390
if let Ok(file) = File::options().open(entry.path()) {
391-
if fstat(file.as_raw_fd())?.st_ino == my_ino {
391+
if fstat(file.as_fd())?.st_ino == my_ino {
392392
fds_to_replace.push(entry.file_name().to_string_lossy().parse::<i32>()?);
393393
}
394394
}
@@ -457,9 +457,9 @@ impl X11ProtocolHandler {
457457
return Err(Errno::EOPNOTSUPP.into());
458458
} else {
459459
let (fd, shmem_path) = mkstemp(SHM_TEMPLATE)?;
460-
let mut shmem_file = unsafe { File::from_raw_fd(fd) };
460+
let mut shmem_file = File::from(fd);
461461
let ret = Self::replace_futex_storage(
462-
memfd.as_raw_fd(),
462+
memfd.as_fd(),
463463
Pid::from_raw(pid),
464464
shmem_path.as_os_str().to_str().unwrap(),
465465
&mut shmem_file,

0 commit comments

Comments
 (0)