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
impl Process
Sourcepub(crate) fn open(pid: Pid) -> Self
pub(crate) fn open(pid: Pid) -> Self
Refer to a child which was not reaped yet, so the PID is still its own.
Sourcepub(crate) fn child(pid: Pid) -> Self
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.
Sourcepub(crate) fn signal(&self, signal: impl Into<Option<Signal>>) -> Result<()>
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.
Sourcepub(crate) fn signal_group(&self, signal: Signal) -> Result<()>
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.
Sourcefn signal_remaining_group(
&self,
signal: Signal,
own_pgid: Option<Pid>,
e: Errno,
) -> Result<()>
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.
fn signal_unlocked(&self, signal: Option<Signal>) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Process
impl RefUnwindSafe for Process
impl Send for Process
impl Sync for Process
impl Unpin for Process
impl UnsafeUnpin for Process
impl UnwindSafe for Process
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].