MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / procguard_kill_children

Function procguard_kill_children

crates/openshell-driver-vm/src/runtime.rs:628–652  ·  view source on GitHub ↗

Shared procguard cleanup callback for both libkrun and QEMU paths. Only async-signal-safe calls: atomic loads and `kill(2)`.

()

Source from the content-addressed store, hash-verified

626/// Shared procguard cleanup callback for both libkrun and QEMU paths.
627/// Only async-signal-safe calls: atomic loads and `kill(2)`.
628fn procguard_kill_children() {
629 let helper_pid = GVPROXY_PID.load(Ordering::Relaxed);
630 let child_pid = CHILD_PID.load(Ordering::Relaxed);
631 if helper_pid > 0 {
632 unsafe {
633 libc::kill(helper_pid, libc::SIGTERM);
634 }
635 }
636 if child_pid > 0 {
637 unsafe {
638 libc::kill(child_pid, libc::SIGTERM);
639 }
640 }
641 std::thread::sleep(Duration::from_millis(200));
642 if helper_pid > 0 {
643 unsafe {
644 libc::kill(helper_pid, libc::SIGKILL);
645 }
646 }
647 if child_pid > 0 {
648 unsafe {
649 libc::kill(child_pid, libc::SIGKILL);
650 }
651 }
652}
653
654fn run_libkrun_vm(config: &VmLaunchConfig) -> Result<(), String> {
655 if let Some(kernel_image) = &config.kernel_image {

Callers

nothing calls this directly

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected