Skip to main content

Process

Struct Process 

Source
pub(crate) struct Process {
    pid: Pid,
    pidfd: Option<OwnedFd>,
}
Expand description

A child process of the server, which can be signalled without hitting another process that reused its PID.

Fields§

§pid: Pid§pidfd: Option<OwnedFd>

Keeps referring to the process after it got reaped, unlike the PID. None if the kernel does not support pidfds.

Implementations§

Source§

impl Process

Source

pub(crate) fn open(pid: Pid) -> Self

Refer to a child which was not reaped yet, so the PID is still its own.

Source

pub(crate) fn child(pid: Pid) -> Self

Refer to a child by its PID alone, which gets checked to still belong to an unreaped child of the server before every signal.

Source

pub(crate) fn pid(&self) -> Pid

The PID of the process.

Source

pub(crate) fn signal(&self, signal: impl Into<Option<Signal>>) -> Result<()>

Signal the process, none only checks that it still exists. Its PID gets reused once something took its exit status, the pidfd still refers to the exited process then and the signal fails with ESRCH instead of hitting another process.

Source

pub(crate) fn signal_group(&self, signal: Signal) -> Result<()>

Signal the process group of the process and the process itself, once it was checked to be unreaped, see REAP_LOCK. The group only gets signalled if signals_group allows it.

A process which got reaped already may have led a group which still has members, like the init of a container without a PID namespace whose children hold the pipes. They got reparented to this server, the subreaper, so the group gets signalled as long as one of them is an unreaped child of the server, which keeps the group ID in use.

Source

fn signal_remaining_group( &self, signal: Signal, own_pgid: Option<Pid>, e: Errno, ) -> Result<()>

Signal the remaining group of a process which is gone, if it still has a member which keeps its ID in use, fail with e otherwise. Not while another process has the PID: the group of a leader which got reaped keeps the ID from getting reused, but once that group is gone as well, a process which reused the PID may lead a group of its own under it.

Source

fn signal_unlocked(&self, signal: Option<Signal>) -> Result<()>

Trait Implementations§

Source§

impl Debug for Process

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more