Skip to main content

CloneArgs

Struct CloneArgs 

Source
pub struct CloneArgs {
    pub flags: CloneFlags,
    pub exit_signal: Option<Signal>,
    pub stack: Option<StackSpecification>,
    pub child_tid: Option<TidReceiver>,
    pub parent_tid: Option<TidReceiver>,
    pub tls: Option<u64>,
}
Expand description

Arguments pour clone3.

La spec couche 0 (docs/specs/layer-0/family-process.md) liste neuf champs (flags, pidfd, child_tid, parent_tid, exit_signal, stack, tls, set_tid, cgroup). Ce type en expose six : les trois du fork classique (flags, exit_signal, stack) plus les trois requis par la création de thread (child_tid, parent_tid, tls). Les restants (pidfd en tant que récepteur typé, set_tid, cgroup) seront ajoutés au fil des syscalls qui les exigent. L’évolution est strictement additive : aucun champ existant n’est destiné à être renommé ou retiré.

Pour demander la création d’un pidfd sur l’enfant, positionner le bit CloneFlags::PIDFD ; le PidFd résultant est retourné dans la variante CloneResult::Parent.

Création de thread. Renseigner stack, child_tid/parent_tid (pour le join via CLONE_CHILD_CLEARTID) et éventuellement tls, puis appeler clone_thread (et non clone3, qui reste dédié au fork).

Fields§

§flags: CloneFlags

Drapeaux de comportement (CLONE_*).

§exit_signal: Option<Signal>

Signal à délivrer au parent à la mort de l’enfant. Some(SIGCHLD) est le choix standard pour clone3 style fork. Doit être None pour un thread (CLONE_THREAD interdit tout signal de sortie).

§stack: Option<StackSpecification>

Pile pour CLONE_VM (création de thread). None pour le fork classique (rejeté par clone3 si renseigné) ; Some(_) est requis par clone_thread.

§child_tid: Option<TidReceiver>

Récepteur du TID enfant côté enfant (CLONE_CHILD_SETTID / CLONE_CHILD_CLEARTID). Pour le join de thread, le pointer sur le même mot que Self::parent_tid et positionner CLONE_CHILD_CLEARTID.

§parent_tid: Option<TidReceiver>

Récepteur du TID enfant côté parent (CLONE_PARENT_SETTID). Écrit par le kernel avant le retour de clone3, sans course.

§tls: Option<u64>

Adresse du bloc TLS de l’enfant (CLONE_SETTLS). None = pas de TLS dédié (l’enfant hérite alors du registre TLS du parent : n’utiliser aucune variable thread_local côté enfant dans ce cas). La spec couche 0 type ce champ en u64 (adresse brute) — voir docs/specs/layer-0/family-process.md.

Trait Implementations§

Source§

impl Clone for CloneArgs

Source§

fn clone(&self) -> CloneArgs

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CloneArgs

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CloneArgs

Source§

fn default() -> CloneArgs

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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.