TaskBuilder

Struct TaskBuilder 

Source
pub struct TaskBuilder {
    pub task: OwnedRef<Task>,
    pub thread_state: Box<ThreadState>,
}

Fields§

§task: OwnedRef<Task>

The underlying task object.

§thread_state: Box<ThreadState>

Implementations§

Source§

impl TaskBuilder

Source

pub fn new(task: OwnedRef<Task>) -> Self

Source

pub fn release<L>(self, locked: &mut Locked<L>)

Methods from Deref<Target = Task>§

Source

pub fn kernel(&self) -> &Arc<Kernel>

Source

pub fn thread_group(&self) -> &Arc<ThreadGroup>

Source

pub fn has_same_address_space(&self, other: Option<&Arc<MemoryManager>>) -> bool

Source

pub fn flags(&self) -> TaskFlags

Source

pub fn set_ptrace_zombie(&self, pids: &mut PidTable)

When the task exits, if there is a notification that needs to propagate to a ptracer, make sure it will propagate.

Source

pub fn exit_status(&self) -> Option<ExitStatus>

Source

pub fn is_exitted(&self) -> bool

Source

pub fn load_stopped(&self) -> StopState

Source

pub fn read<'a>(self: &'a Task) -> TaskReadGuard<'a>

Source

pub fn write<'a>(self: &'a Task) -> TaskWriteGuard<'a>

Source

pub fn add_file<L>( &self, locked: &mut Locked<L>, file: FileHandle, flags: FdFlags, ) -> Result<FdNumber, Errno>

Source

pub fn real_creds(&self) -> Credentials

Returns the real credentials of the task. These credentials are used to check permissions for actions performed on the task. If the task itself is performing an action, use CurrentTask::current_creds instead.

Source

pub fn with_real_creds<B, F>(&self, f: F) -> B
where F: FnOnce(&Credentials) -> B,

Source

pub fn ptracer_task(&self) -> WeakRef<Task>

Source

pub fn fs(&self) -> Arc<FsContext>

Source

pub fn has_shared_fs(&self) -> bool

Source

pub fn mm(&self) -> Result<Arc<MemoryManager>, Errno>

Source

pub fn unshare_fs(&self)

Source

pub fn set_scheduler_state( &self, scheduler_state: SchedulerState, ) -> Result<(), Errno>

Overwrite the existing scheduler state with a new one and update the task’s thread’s role.

Source

pub fn sync_scheduler_state_to_role(&self) -> Result<(), Errno>

Update the task’s thread’s role based on its current scheduler state without making any changes to the state.

This should be called on tasks that have newly created threads, e.g. after cloning.

Source

pub fn signal_vfork(&self)

Signals the vfork event, if any, to unblock waiters.

Source

pub fn wait_for_execve(&self, task_to_wait: WeakRef<Task>) -> Result<(), Errno>

Blocks the caller until the task has exited or executed execve(). This is used to implement vfork() and clone(… CLONE_VFORK, …). The task must have created with CLONE_EXECVE.

Source

pub fn clear_child_tid_if_needed<L>( &self, locked: &mut Locked<L>, ) -> Result<(), Errno>

If needed, clear the child tid for this task.

Userspace can ask us to clear the child tid and issue a futex wake at the child tid address when we tear down a task. For example, bionic uses this mechanism to implement pthread_join. The thread that calls pthread_join sleeps using FUTEX_WAIT on the child tid address. We wake them up here to let them know the thread is done.

Source

pub fn get_task(&self, tid: tid_t) -> WeakRef<Task>

Source

pub fn get_pid(&self) -> pid_t

Source

pub fn get_tid(&self) -> tid_t

Source

pub fn is_leader(&self) -> bool

Source

pub fn read_argv(&self, max_len: usize) -> Result<Vec<FsString>, Errno>

Source

pub fn read_argv0(&self) -> Result<FsString, Errno>

Source

pub fn read_env(&self, max_len: usize) -> Result<Vec<FsString>, Errno>

Source

pub fn thread_runtime_info(&self) -> Result<TaskRuntimeInfo, Errno>

Source

pub fn real_fscred(&self) -> FsCred

Source

pub fn interrupt(&self)

Interrupts the current task.

This will interrupt any blocking syscalls if the task is blocked on one. The signal_state of the task must not be locked.

Source

pub fn command(&self) -> TaskCommand

Source

pub fn set_command_name(&self, new_name: TaskCommand)

Source

pub fn set_seccomp_state(&self, state: SeccompStateValue) -> Result<(), Errno>

Source

pub fn state_code(&self) -> TaskStateCode

Source

pub fn time_stats(&self) -> TaskTimeStats

Source

pub fn get_signal_action(&self, signal: Signal) -> sigaction_t

Source

pub fn record_pid_koid_mapping(&self)

Trait Implementations§

Source§

impl Deref for TaskBuilder

Source§

type Target = Task

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl From<TaskBuilder> for AutoReleasableTask

Source§

fn from(builder: TaskBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<TaskBuilder> for CurrentTask

Source§

fn from(builder: TaskBuilder) -> Self

Converts to this type from the input type.
Source§

impl Releasable for TaskBuilder

Source§

type Context<'a> = &'a mut Locked<TaskRelease>

Source§

fn release<'a>(self, locked: Self::Context<'a>)

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> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn type_name(&self) -> &'static str

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, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> InstanceFromServiceTransport<T> for T

§

fn from_service_transport(handle: T) -> T

Converts the given service transport handle of type T to [Self]
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> Into32<U> for T
where U: MultiArchFrom<T>,

Source§

fn into_32(self) -> U

Source§

impl<T, U> Into64<U> for T
where U: MultiArchFrom<T>,

Source§

fn into_64(self) -> U

Source§

impl<T> IntoAny for T
where T: 'static + Send + Sync,

Source§

fn into_any(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Cast the given object into a dyn std::any::Any.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T, U> IntoExt<U> for T
where U: FromExt<T>,

§

fn into_ext(self) -> U

Performs the conversion.
Source§

impl<T, U> IntoFidl<U> for T
where U: FromFidl<T>,

Source§

fn into_fidl(self) -> U

Source§

impl<T, U> MultiArchFrom<T> for U
where U: From<T>,

Source§

fn from_64(value: T) -> U

Source§

fn from_32(value: T) -> U

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T, U> TryIntoExt<U> for T
where U: TryFromExt<T>,

§

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

§

fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>

Tries to perform the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<St> WithTag for St

§

fn tagged<T>(self, tag: T) -> Tagged<T, St>

Produce a new stream from this one which yields item tupled with a constant tag
Source§

impl<B, A> LockBefore<B> for A
where B: LockAfter<A>,

Source§

impl<B, A> LockEqualOrBefore<B> for A
where A: LockBefore<B>,

§

impl<E> RunsTransport<Mpsc> for E

§

impl<E> RunsTransport<Mpsc> for E
where E: RunsTransport<Mpsc>,