Skip to content

Commit 288cc80

Browse files
zzzzzzzzzy9mxpv
authored andcommitted
add process info to pids() interface
1 parent b308d13 commit 288cc80

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

crates/runc-shim/src/container.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use containerd_shim::{
2222
protos::{
2323
api::{CreateTaskRequest, ExecProcessRequest, ProcessInfo, StateResponse},
2424
cgroups::metrics::Metrics,
25+
protobuf::{well_known_types::any::Any, Message},
2526
},
2627
Error,
2728
};
@@ -185,7 +186,16 @@ where
185186
}
186187

187188
async fn all_processes(&self) -> Result<Vec<ProcessInfo>> {
188-
self.init.ps().await
189+
let mut processes_info = self.init.ps().await?;
190+
for process_info in &mut processes_info {
191+
for (exec_id, process) in &self.processes {
192+
if process_info.pid as i32 == process.pid().await {
193+
process_info.set_info(Any::parse_from_bytes(exec_id.as_bytes())?);
194+
break;
195+
}
196+
}
197+
}
198+
Ok(processes_info)
189199
}
190200

191201
async fn close_io(&mut self, exec_id: Option<&str>) -> Result<()> {

0 commit comments

Comments
 (0)