Give crosvm process a unique name
This change uses the new --name option to set the name of the crosvm
process. This is to distinguish different crosvm instances (in `ps` or
in go/pitot).
Bug: 375094126
Test: see below
$ ps -A| grep crosvm
u10_a278 13959 13933 15499192 44316 0 0 S
crosvm_debian
$ cat /proc/$(pgrep crosvm)/comm
crosvm_debian
Change-Id: Ic92c51886a574eeada609a4c2ba66742c69e3b31
diff --git a/android/virtmgr/src/crosvm.rs b/android/virtmgr/src/crosvm.rs
index 25271f8..2cd1742 100644
--- a/android/virtmgr/src/crosvm.rs
+++ b/android/virtmgr/src/crosvm.rs
@@ -35,6 +35,7 @@
use std::mem;
use std::num::{NonZeroU16, NonZeroU32};
use std::os::unix::io::{AsRawFd, OwnedFd};
+use std::os::unix::process::CommandExt;
use std::os::unix::process::ExitStatusExt;
use std::path::{Path, PathBuf};
use std::process::{Command, ExitStatus};
@@ -893,6 +894,9 @@
validate_config(&config)?;
let mut command = Command::new(CROSVM_PATH);
+
+ let vm_name = "crosvm_".to_owned() + &config.name;
+ command.arg0(vm_name.clone());
// TODO(qwandor): Remove --disable-sandbox.
command
.arg("--extended-status")
@@ -901,6 +905,8 @@
.arg("--log-level")
.arg("info,disk=warn")
.arg("run")
+ .arg("--name")
+ .arg(vm_name)
.arg("--disable-sandbox")
.arg("--cid")
.arg(config.cid.to_string());