Skip to content

Commit

Permalink
Merge pull request #8710 from jodh-intel/runtime-rs-ch-get-thread-ids
Browse files Browse the repository at this point in the history
runtime-rs: ch: Implement minimal implementation for missing thread/pid APIs
  • Loading branch information
cmaf committed Jan 17, 2024
2 parents 147d5fd + 7da6d0a commit 32ad465
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/runtime-rs/crates/hypervisor/src/ch/inner_hypervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use lazy_static::lazy_static;
use nix::sched::{setns, CloneFlags};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
use std::convert::TryFrom;
use std::fs::create_dir_all;
use std::os::unix::io::AsRawFd;
Expand Down Expand Up @@ -676,7 +677,16 @@ impl CloudHypervisorInner {
}

pub(crate) async fn get_thread_ids(&self) -> Result<VcpuThreadIds> {
Ok(VcpuThreadIds::default())
let mut vcpus = HashMap::new();

let vcpu = 0;
let thread_id = self.get_vmm_master_tid().await?;

vcpus.insert(vcpu, thread_id);

let vcpu_thread_ids = VcpuThreadIds { vcpus };

Ok(vcpu_thread_ids)
}

pub(crate) async fn cleanup(&self) -> Result<()> {
Expand All @@ -688,7 +698,9 @@ impl CloudHypervisorInner {
}

pub(crate) async fn get_pids(&self) -> Result<Vec<u32>> {
Ok(Vec::<u32>::new())
let pid = self.get_vmm_master_tid().await?;

Ok(vec![pid])
}

pub(crate) async fn get_vmm_master_tid(&self) -> Result<u32> {
Expand Down

0 comments on commit 32ad465

Please sign in to comment.