MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / reaper_kill

Function reaper_kill

src/process/procctl.rs:425–447  ·  view source on GitHub ↗

Deliver a signal to some subset of the descendants of the reaper. # References - [FreeBSD: `procctl(PROC_REAP_KILL,…)`] [FreeBSD: `procctl(PROC_REAP_KILL,…)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2

(
    process: ProcSelector,
    signal: Signal,
    direct_children: bool,
    subtree: Option<Pid>,
)

Source from the content-addressed store, hash-verified

423///
424/// [FreeBSD: `procctl(PROC_REAP_KILL,…)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
425pub fn reaper_kill(
426 process: ProcSelector,
427 signal: Signal,
428 direct_children: bool,
429 subtree: Option<Pid>,
430) -> io::Result<KillResult> {
431 let mut flags = KillFlags::empty();
432 flags.set(KillFlags::CHILDREN, direct_children);
433 flags.set(KillFlags::SUBTREE, subtree.is_some());
434 let mut req = procctl_reaper_kill {
435 rk_sig: signal.as_raw(),
436 rk_flags: flags.bits(),
437 rk_subtree: subtree.map(|p| p.as_raw_nonzero().into()).unwrap_or(0),
438 rk_killed: 0,
439 rk_fpid: 0,
440 rk_pad0: [0; 15],
441 };
442 unsafe { procctl(PROC_REAP_KILL, process, as_mut_ptr(&mut req).cast())? };
443 Ok(KillResult {
444 killed: req.rk_killed as _,
445 first_failed: Pid::from_raw(req.rk_fpid),
446 })
447}
448
449//
450// PROC_TRAPCAP_STATUS/PROC_TRAPCAP_CTL

Callers

nothing calls this directly

Calls 5

as_mut_ptrFunction · 0.85
setMethod · 0.80
procctlFunction · 0.70
as_rawMethod · 0.45
as_raw_nonzeroMethod · 0.45

Tested by

no test coverage detected