[][src]Struct tabox::configuration::SandboxConfiguration

pub struct SandboxConfiguration {
    pub time_limit: Option<u64>,
    pub memory_limit: Option<u64>,
    pub executable: PathBuf,
    pub args: Vec<String>,
    pub env: Vec<(String, String)>,
    pub mount_paths: Vec<DirectoryMount>,
    pub working_directory: PathBuf,
    pub stdin: Option<PathBuf>,
    pub stdout: Option<PathBuf>,
    pub stderr: Option<PathBuf>,
    pub syscall_filter: Option<SyscallFilter>,
    pub mount_tmpfs: bool,
    pub wall_time_limit: Option<u64>,
    pub cpu_core: Option<usize>,
}

struct that represents the configuration parameters of a sandbox

Fields

time_limit: Option<u64>

Time limit for the execution in seconds

memory_limit: Option<u64>

Memory limit fot the execution in bytes

executable: PathBuf

Absolute path of the executable

args: Vec<String>

Arguments to pass to the executable

env: Vec<(String, String)>

Environment to pass to the sandbox

mount_paths: Vec<DirectoryMount>

Allowed paths inside the sandbox

working_directory: PathBuf

Working directory

stdin: Option<PathBuf>

Redirect stdin from this file

stdout: Option<PathBuf>

Redirect stdout from this file

stderr: Option<PathBuf>

Redirect stderr from this file

syscall_filter: Option<SyscallFilter>

Allow only these system calls in the sandbox

mount_tmpfs: bool

Mount a r/w tmpfs in /tmp and /dev/shm

wall_time_limit: Option<u64>

Wall time limit

cpu_core: Option<usize>

Set on which CPU core to run the sandbox

Methods

impl SandboxConfiguration[src]

pub fn build(&self) -> SandboxConfiguration[src]

Build the sandbox configuration

pub fn time_limit(&mut self, time_limit: u64) -> &mut Self[src]

Set the time limit in seconds

pub fn memory_limit(&mut self, memory_limit: u64) -> &mut Self[src]

Set the memory limit, in bytes

pub fn stdin<P: Into<PathBuf>>(&mut self, stdin: P) -> &mut Self[src]

Set the standard input file path

pub fn stdout<P: Into<PathBuf>>(&mut self, stdout: P) -> &mut Self[src]

Set the standard output file path

pub fn stderr<P: Into<PathBuf>>(&mut self, stderr: P) -> &mut Self[src]

Set the standard error file path

pub fn executable<P: Into<PathBuf>>(&mut self, executable: P) -> &mut Self[src]

Set the executable file path

pub fn working_directory<P: Into<PathBuf>>(
    &mut self,
    working_directory: P
) -> &mut Self
[src]

Set the working directory

pub fn arg<S: Into<String>>(&mut self, arg: S) -> &mut Self[src]

Add an argument to the program

pub fn env<S: Into<String>, T: Into<String>>(
    &mut self,
    variable: S,
    value: T
) -> &mut Self
[src]

Add an argument to the environment

pub fn mount<P, Q>(&mut self, source: P, target: Q, writable: bool) -> &mut Self where
    P: Into<PathBuf>,
    Q: Into<PathBuf>, 
[src]

Add a mount point into the sandbox

pub fn syscall_filter(&mut self, filter: SyscallFilter) -> &mut Self[src]

Install the syscall filter

pub fn mount_tmpfs(&mut self, value: bool) -> &mut Self[src]

Mount a r/w tmpfs in /tmp and /dev/shm

pub fn wall_time_limit(&mut self, value: u64) -> &mut Self[src]

Set wall time limit

pub fn run_on_core(&mut self, value: usize) -> &mut Self[src]

Run the sandbox on the specified cpu core

Trait Implementations

impl Clone for SandboxConfiguration[src]

impl Debug for SandboxConfiguration[src]

impl Default for SandboxConfiguration[src]

impl<'de> Deserialize<'de> for SandboxConfiguration[src]

impl Serialize for SandboxConfiguration[src]

Auto Trait Implementations

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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[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, 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.