Skip to main content

CommandPidsLimitsExt

Trait CommandPidsLimitsExt 

Source
pub trait CommandPidsLimitsExt {
    // Required method
    fn check_pids_limits(
        &mut self,
        limits: Arc<[PidsLimit]>,
    ) -> Result<(), Error>;
}
Available on Unix only.
Expand description

Extension trait for checking process counts before a command runs.

Required Methods§

Source

fn check_pids_limits(&mut self, limits: Arc<[PidsLimit]>) -> Result<(), Error>

Arranges for the command, after it is forked and before it runs its program, to read each limit’s count and to fail its spawn when a count is above its limit (EAGAIN, the error fork returns at pids.max) or cannot be read (EIO).

In the process that registered it, as on a path that runs the command’s steps with no fork, the check fails with ENOTSUP without reading a count: there a count would include every thread of that process, and the exec builtin refuses such a command before it composes it.

§Errors

None here: a child whose check fails fails its spawn.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl CommandPidsLimitsExt for Command

Source§

fn check_pids_limits(&mut self, limits: Arc<[PidsLimit]>) -> Result<(), Error>

Implementors§