Clone3

Struct Clone3 

Source
pub struct Clone3<'a> { /* private fields */ }
Expand description

High level wrapper around the clone3 system call.

Construct it with Clone3::default() which sets no flags and no exit signal. Use builder methods to customize the underlying CloneArgs. Perform the system call with call.

Implementations§

Source§

impl<'a> Clone3<'a>

Source

pub fn flag_child_cleartid(&mut self, child_tid: &'a mut pid_t) -> &mut Self

Source

pub fn flag_child_settid(&mut self, child_tid: &'a mut pid_t) -> &mut Self

Source

pub fn flag_clear_sighand(&mut self) -> &mut Self

Source

pub fn flag_files(&mut self) -> &mut Self

Source

pub fn flag_fs(&mut self) -> &mut Self

Source

pub fn flag_into_cgroup(&mut self, cgroup: &'a dyn AsRawFd) -> &mut Self

Source

pub fn flag_io(&mut self) -> &mut Self

Source

pub fn flag_newcgroup(&mut self) -> &mut Self

Source

pub fn flag_newipc(&mut self) -> &mut Self

Source

pub fn flag_newnet(&mut self) -> &mut Self

Source

pub fn flag_newns(&mut self) -> &mut Self

Source

pub fn flag_newpid(&mut self) -> &mut Self

Source

pub fn flag_newtime(&mut self) -> &mut Self

Source

pub fn flag_newuser(&mut self) -> &mut Self

Source

pub fn flag_newuts(&mut self) -> &mut Self

Source

pub fn flag_parent(&mut self) -> &mut Self

Source

pub fn flag_parent_settid(&mut self, parent_tid: &'a mut pid_t) -> &mut Self

Source

pub fn flag_pidfd(&mut self, pidfd: &'a mut RawFd) -> &mut Self

Source

pub fn flag_ptrace(&mut self) -> &mut Self

Source

pub fn flag_settls(&mut self, tls: u64) -> &mut Self

Source

pub fn flag_sighand(&mut self) -> &mut Self

Source

pub fn flag_sysvsem(&mut self) -> &mut Self

Source

pub fn flag_thread(&mut self) -> &mut Self

Source

pub fn flag_untraced(&mut self) -> &mut Self

Source

pub fn flag_vfork(&mut self) -> &mut Self

Source

pub fn flag_vm(&mut self, stack: &'a mut [u8]) -> &mut Self

Source

pub fn exit_signal(&mut self, exit_signal: u64) -> &mut Self

Source

pub fn stack(&mut self, stack: &'a mut [u8]) -> &mut Self

Source

pub fn set_tid(&mut self, set_tid: &'a [pid_t]) -> &mut Self

Source

pub unsafe fn call(&mut self) -> Result<pid_t, Errno>

Performs the system call.

§Errors

Errors if the system call returns -1.

§Panics

Panics if the set flags are incompatible:

  • CHILD_CLEARTID and CHILD_SETTID must not be set together
  • CLEAR_SIGHAND and SIGHAND must not be set together
  • NEWIPC and SYSVSEM must not be set together
  • FS and NEWNS must not be set together
  • THREAD and PIDFD must not be set together
  • NEWPID must not be set with PARENT or THREAD
  • NEWUSER must not be set with FS or PARENT or THREAD
  • if SIGHAND is set then VM must be set
  • if THREAD is set then SIGHAND must be set

Panics if the system call returns a value that neither indicates failure nor is convertible to pid_t which could happen on overflow due to different type sizes. This is a bug in the Linux kernel or the libc bindings used by this crate.

Source

pub unsafe fn call_unchecked(&mut self) -> c_long

Performs the system call.

Like call but never errors or panics. Forwards the return value of the system call.

Source

pub fn as_clone_args(&mut self) -> CloneArgs

Returns the underlying CloneArgs.

Prefer using call instead. If you manually perform the system call you must ensure that the referenced variables stay alive and the referenced mutable variables are not aliased.

Trait Implementations§

Source§

impl<'a> Default for Clone3<'a>

Source§

fn default() -> Clone3<'a>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Clone3<'a>

§

impl<'a> !RefUnwindSafe for Clone3<'a>

§

impl<'a> !Send for Clone3<'a>

§

impl<'a> !Sync for Clone3<'a>

§

impl<'a> Unpin for Clone3<'a>

§

impl<'a> !UnwindSafe for Clone3<'a>

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.