[][src]Enum rctl::State

pub enum State {
    Disabled,
    Enabled,
    NotPresent,
    Jailed,
}

Enum representing the state of RACCT/RCTL in the kernel.

Variants

Disabled

RCTL / RACCT is present in the kernel, but is not enabled via the kern.racct.enable tunable.

Enabled

RCTL / RACCT is enabled.

NotPresent

RCTL / RACCT is disabled.

The kernel does not support RCTL / RACCT. The following options have to be set in the kernel configuration when compiling the kernel to add support for RCTL / RACCT:

This example is not tested
options         RACCT
options         RCTL
Jailed

RCTL is not available within a Jail

Implementations

impl State[src]

pub fn check() -> State[src]

Check the state of the RCTL / RACCT support.

This queries the kern.racct.enable sysctl. If this fails in any way, (most probably by the sysctl not being present), the kernel is assumed to be compiled without the RCTL / RACCT options.

Example

let state = rctl::State::check();

pub fn is_enabled(&self) -> bool[src]

Return true if the RCTL / RACCT support is Enabled.

Examples

if rctl::State::check().is_enabled() {
    // do things requiring `RCTL` / `RACCT` support.
}

pub fn is_present(&self) -> bool[src]

Return true if the kernel has RCTL / RACCT support compiled in.

Examples

if ! rctl::State::check().is_present() {
    println!("The kernel does not have RCTL / RACCT support");
}

Trait Implementations

impl Clone for State[src]

impl Copy for State[src]

impl Debug for State[src]

impl Display for State[src]

impl Eq for State[src]

impl Hash for State[src]

impl PartialEq<State> for State[src]

impl StructuralEq for State[src]

impl StructuralPartialEq for State[src]

Auto Trait Implementations

impl RefUnwindSafe for State

impl Send for State

impl Sync for State

impl Unpin for State

impl UnwindSafe for State

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.