pub struct ProcessHandle { /* private fields */ }Expand description
The OS liveness handle this module hands out.
It is the facade’s handle: the ownership rules that make it trustworthy – a pidfd, a kqueue subscription, an open process handle – belong to the host that issued it, not to this module’s vocabulary. A live reference to another process, good for as long as it is held.
Where the kernel offers one, this holds a pidfd: a PID can be recycled between two questions, but a pidfd cannot, so a handle opened once keeps naming the process it was opened for even after that process exits. Older kernels have no such thing, and there the handle falls back to asking about the PID – which is the best this host can do, not an equivalent.
Implementations§
Source§impl ProcessLiveness
impl ProcessLiveness
Sourcepub fn open_for_control(
pid: u32,
) -> Result<ProcessLiveness, ProcessInspectError>
pub fn open_for_control( pid: u32, ) -> Result<ProcessLiveness, ProcessInspectError>
Acquire a kernel-pinned handle suitable for identity-safe control.
Sourcepub fn force_kill(&self) -> Result<(), Error>
pub fn force_kill(&self) -> Result<(), Error>
Force termination through the held pidfd, never by reopening the PID.
Sourcepub fn has_exited(&self) -> Result<bool, Error>
pub fn has_exited(&self) -> Result<bool, Error>
Confirm terminal state through the held pidfd without reopening the PID.
Sourcepub fn open(pid: u32) -> Result<ProcessLiveness, ProcessInspectError>
pub fn open(pid: u32) -> Result<ProcessLiveness, ProcessInspectError>
Take a reference to pid, failing if no such process is running.
Trait Implementations§
Source§impl Debug for ProcessLiveness
impl Debug for ProcessLiveness
Auto Trait Implementations§
impl Freeze for ProcessLiveness
impl RefUnwindSafe for ProcessLiveness
impl Send for ProcessLiveness
impl Sync for ProcessLiveness
impl Unpin for ProcessLiveness
impl UnsafeUnpin for ProcessLiveness
impl UnwindSafe for ProcessLiveness
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more