Struct Seccomp

Source
pub struct Seccomp { /* private fields */ }

Implementations§

Source§

impl Seccomp

Source

pub fn init(act: c_uint) -> Self

initialize the seccomp and set the context into the struct

Source

pub fn load(self) -> Result<c_int, String>

load seccomp to kernel

Source

pub fn add_arch(&self, arch_token: c_uint) -> Result<c_int, String>

add an architecture

Source

pub fn remove_arch(&self, arch_token: c_uint) -> Result<c_int, String>

remove an architecture

Source

pub fn get_attr( ctx: *const SCMP_FILTER_CTX, attr: SCMP_FILTER_ATTR, value: *mut c_uint, ) -> Result<*mut c_uint, String>

Source

pub fn set_attr( &self, attr: SCMP_FILTER_ATTR, value: c_uint, ) -> Result<c_int, String>

Source

pub fn add_exact_rule( &self, action: c_uint, syscall: c_int, arg_cnt: c_uint, arg: SCMP_ARG_CMP, ) -> Result<c_int, String>

Source

pub fn add_exact_rules( &self, action: c_uint, syscall: c_int, arg_cnt: c_uint, arg_array: Vec<SCMP_ARG_CMP>, ) -> Result<c_int, String>

Source

pub fn add_rule( &self, action: c_uint, syscall: c_int, arg_cnt: c_uint, arg: SCMP_ARG_CMP, ) -> Result<c_int, String>

adding rule to seccomp before the seccomp loaded to kernel

Source

pub fn add_rules( &self, action: c_uint, syscall: c_int, arg_cnt: c_uint, arg_array: Vec<SCMP_ARG_CMP>, ) -> Result<c_int, String>

adding rules(vector) to seccomp before the seccomp loaded to kernel

Source

pub fn export_bpf( ctx: *const SCMP_FILTER_CTX, fd: c_int, ) -> Result<c_int, String>

Source

pub fn export_pfc( ctx: *const SCMP_FILTER_CTX, fd: c_int, ) -> Result<c_int, String>

Source

pub fn resolve_syscall_name(name: &str) -> i32

if you are using arm/aarch64 you could use this instead of SCMP_SYS

Source

pub fn syscall_priority( &self, syscall: c_int, priority: u8, ) -> Result<c_int, String>

Source

pub fn reset(&self, def_action: c_uint) -> Result<c_int, String>

reset the seccomp

Source

pub fn release(ctx: *mut SCMP_FILTER_CTX)

release the seccomp from kernel

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.