-
-
Notifications
You must be signed in to change notification settings - Fork 53
Fix miscellaneous small annoyances #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
81ba91c
0a65332
b38e9c0
a7b5085
2936c0a
5b7e9fd
9c176a3
4ac27cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ use muvm::guest::server::server_main; | |
| use muvm::guest::socket::setup_socket_proxy; | ||
| use muvm::guest::user::setup_user; | ||
| use muvm::guest::x11::setup_x11_forwarding; | ||
| use muvm::utils::env::get_var_if_exists; | ||
| use muvm::utils::launch::{Emulator, GuestConfiguration, PULSE_SOCKET}; | ||
| use nix::unistd::{Gid, Uid}; | ||
| use rustix::process::{getrlimit, setrlimit, Resource}; | ||
|
|
@@ -77,27 +78,42 @@ fn main() -> Result<ExitCode> { | |
| rustix::stdio::dup2_stdout(console.as_fd())?; | ||
| rustix::stdio::dup2_stderr(console.as_fd())?; | ||
|
|
||
| Command::new("/usr/lib/systemd/systemd-udevd").spawn()?; | ||
| const DEFAULT_UDEVD_PATH: &str = match std::option_env!("MUVM_UDEVD_PATH") { | ||
| Some(path) => path, | ||
| None => "/usr/lib/systemd/systemd-udevd", | ||
| }; | ||
| Command::new( | ||
| get_var_if_exists("MUVM_UDEVD_PATH") | ||
| .unwrap_or_else(|| Ok(DEFAULT_UDEVD_PATH.to_owned()))?, | ||
| ) | ||
| .spawn() | ||
| .context("Failed to execute `systemd-udevd` as a child process")?; | ||
| // SAFETY: We are single-threaded at this point | ||
| env::remove_var("MUVM_UDEVD_PATH"); | ||
teohhanhui marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if let Some(emulator) = options.emulator { | ||
| match emulator { | ||
| Emulator::Box => setup_box()?, | ||
| Emulator::Fex => setup_fex()?, | ||
| }; | ||
| } else if let Err(err) = setup_fex() { | ||
| eprintln!("Error setting up FEX in binfmt_misc: {err}"); | ||
| eprintln!("Failed to find or configure FEX, falling back to Box"); | ||
|
|
||
| if let Err(err) = setup_box() { | ||
| eprintln!("Error setting up Box in binfmt_misc: {err}"); | ||
| eprintln!("No emulators were configured, x86 emulation may not work"); | ||
| } else { | ||
| #[cfg(target_arch = "aarch64")] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably also kill x11 forwarding in this case, it is aarch64 only. (Or fix it to work on x86 too, shouldn't be that hard)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Huh, what's broken about it? I'll test it..
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/AsahiLinux/muvm/blob/main/crates/muvm/src/guest/bridge/x11.rs#L640 - the entirety of RemoteCaller is aarch64 specific
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, should do something like this: https://gist.github.com/WhatAmISupposedToPutHere/3b51d4266ca5d7b75f0571adafba031a (build tested on x86 only, may or may not work)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete this line, it should force it to use the ptrace method: https://github.com/AsahiLinux/muvm/blob/main/crates/muvm/src/guest/x11.rs#L24
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, now I do see my debug prints! during initialization/resizing of GPU programs, and it still works fine \o/ |
||
| if let Err(err) = setup_fex() { | ||
| eprintln!("Error setting up FEX in binfmt_misc: {err}"); | ||
| eprintln!("Failed to find or configure FEX, falling back to Box64"); | ||
|
|
||
| if let Err(err) = setup_box() { | ||
| eprintln!("Error setting up Box64 in binfmt_misc: {err}"); | ||
| eprintln!("No emulators were configured, x86 emulation may not work"); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| for init_command in options.init_commands { | ||
| let code = Command::new(&init_command) | ||
| .current_dir(&options.cwd) | ||
| .spawn()? | ||
| .spawn() | ||
| .with_context(|| format!("Failed to execute init command {init_command:?}"))? | ||
| .wait()?; | ||
| if !code.success() { | ||
| return Err(anyhow!("Executing `{}` failed", init_command.display())); | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.