Treat CID on cmdline as signed
We pass a CID value of -1U (VMADDR_CID_ANY) from composd to odrefresh
to pvm_exec as a sentinel value to indicate use of
composd. Unfortunately odrefresh expects it to be signed while composd
and pvm_exec expect it to be unsigned, leading to test breakge.
This CL moves everything to signed. (Technically unsigned is more
correct, but -1 looks more elegant than 4294967295.
Fixes: 202696349
Test: atest ComposTestCase
Test: adb shell apex/com.android.compos/bin/composd_cmd
Change-Id: I9f8cbe85ebf6755a158c20de95c62e3d44591db0
diff --git a/compos/composd/src/odrefresh.rs b/compos/composd/src/odrefresh.rs
index 54da231..2d880e2 100644
--- a/compos/composd/src/odrefresh.rs
+++ b/compos/composd/src/odrefresh.rs
@@ -40,7 +40,7 @@
pub fn run_forced_compile() -> Result<ExitCode> {
// We don`t need to capture stdout/stderr - odrefresh writes to the log
let mut odrefresh = Command::new(ODREFRESH_BIN)
- .arg(format!("--use-compilation-os={}", VMADDR_CID_ANY))
+ .arg(format!("--use-compilation-os={}", VMADDR_CID_ANY as i32))
.arg("--force-compile")
.spawn()
.context("Running odrefresh")?;
diff --git a/compos/src/pvm_exec.rs b/compos/src/pvm_exec.rs
index fd5ffaf..cae0702 100644
--- a/compos/src/pvm_exec.rs
+++ b/compos/src/pvm_exec.rs
@@ -158,7 +158,7 @@
let output_fds = results?;
let args: Vec<_> = matches.values_of("args").unwrap().map(|s| s.to_string()).collect();
- let cid = value_t!(matches, "cid", u32)?;
+ let cid = value_t!(matches, "cid", i32)? as u32;
let debuggable = matches.is_present("debug");
Ok(Config { args, fd_annotation: FdAnnotation { input_fds, output_fds }, cid, debuggable })