Guard

Struct Guard 

Source
pub struct Guard<'a, B, G> {
    pub base: &'a B,
    /* private fields */
}

Fields§

§base: &'a B

Implementations§

Source§

impl<'guard, G: 'guard + Deref<Target = TerminalMutableState>> Guard<'guard, Terminal, G>

Source

pub fn termios(&self) -> &termios

Returns the terminal configuration.

Source

pub fn get_available_read_size(&self, is_main: bool) -> usize

Returns the number of available bytes to read from the side of the terminal described by is_main.

Source

pub fn is_main_closed(&self) -> bool

Source§

impl<'guard, G: 'guard + DerefMut<Target = TerminalMutableState>> Guard<'guard, Terminal, G>

Source

pub fn main_close(&mut self)

close implementation of the main side of the terminal.

Source

pub fn main_open(&mut self)

Called when a new reference to the main side of this terminal is made.

Source

pub fn replica_close(&mut self)

close implementation of the replica side of the terminal.

Source

pub fn replica_open(&mut self)

Called when a new reference to the replica side of this terminal is made.

Source§

impl<'a, B, S> Guard<'a, B, MutexGuard<'a, S>>

Source

pub fn unlocked<F, U>(s: &mut Self, f: F) -> U
where F: FnOnce() -> U,

Source§

impl<'guard, B, S, G: 'guard + Deref<Target = S>> Guard<'guard, B, G>

Source

pub fn new(base: &'guard B, guard: G) -> Self

Source

pub fn as_ref(&self) -> StateRef<'_, B, S>

Source§

impl<'guard, B, S, G: 'guard + DerefMut<Target = S>> Guard<'guard, B, G>

Source

pub fn as_mut(&mut self) -> StateMutRef<'_, B, S>

Source§

impl<'guard, G: 'guard + Deref<Target = ProcessGroupMutableState>> Guard<'guard, ProcessGroup, G>

Source

pub fn thread_groups(&self) -> Box<dyn Iterator<Item = Arc<ThreadGroup>> + '_>

Source§

impl<'guard, G: 'guard + Deref<Target = SessionMutableState>> Guard<'guard, Session, G>

Source§

impl<'guard, G: 'guard + DerefMut<Target = SessionMutableState>> Guard<'guard, Session, G>

Source

pub fn remove(&mut self, pid: pid_t)

Removes the process group from the session. Returns whether the session is empty.

Source

pub fn insert(&mut self, process_group: &Arc<ProcessGroup>)

Source

pub fn set_foreground_process_group( &mut self, process_group: &Arc<ProcessGroup>, )

Source§

impl<'guard, G: 'guard + Deref<Target = TaskMutableState>> Guard<'guard, Task, G>

Source

pub fn pending_signal_count(&self) -> usize

Returns the number of pending signals for this task, without considering the signal mask.

Source

pub fn has_signal_pending(&self, signal: Signal) -> bool

Returns true if signal is pending for this task, without considering the signal mask.

Source

pub fn pending_signals(&self) -> SigSet

The set of pending signals for the task, including the signals pending for the thread group.

Source

pub fn task_specific_pending_signals(&self) -> SigSet

The set of pending signals for the task specifically, not including the signals pending for the thread group.

Source

pub fn is_any_signal_allowed_by_mask(&self, mask: SigSet) -> bool

Returns true if any currently pending signal is allowed by mask.

Source

pub fn is_any_signal_pending(&self) -> bool

Returns whether or not a signal is pending for this task, taking the current signal mask into account.

Source§

impl<'guard, G: 'guard + DerefMut<Target = TaskMutableState>> Guard<'guard, Task, G>

Source

pub fn set_stopped( &mut self, stopped: StopState, siginfo: Option<SignalInfo>, current_task: Option<&CurrentTask>, event: Option<PtraceEventData>, )

Source

pub fn set_ptrace( &mut self, tracer: Option<Box<PtraceState>>, ) -> Result<(), Errno>

Source

pub fn can_accept_ptrace_commands(&mut self) -> bool

Source

pub fn update_flags(&mut self, clear: TaskFlags, set: TaskFlags)

Source

pub fn set_flags(&mut self, flag: TaskFlags, v: bool)

Source

pub fn set_exit_status(&mut self, status: ExitStatus)

Source

pub fn set_exit_status_if_not_already(&mut self, status: ExitStatus)

Source

pub fn take_specific_signal( &mut self, siginfo: SignalInfo, ) -> Option<SignalInfo>

Removes and returns the next pending signal for this task.

Returns None if siginfo is a blocked signal, or no such signal is pending.

Source

pub fn take_any_signal(&mut self) -> Option<SignalInfo>

Removes and returns a pending signal that is unblocked by the current signal mask.

Returns None if there are no unblocked signals pending.

Source

pub fn take_signal_with_mask( &mut self, signal_mask: SigSet, ) -> Option<SignalInfo>

Removes and returns a pending signal that is unblocked by signal_mask.

Returns None if there are no signals pending that are unblocked by signal_mask.

Source

pub fn take_kernel_signal(&mut self) -> Option<KernelSignal>

Removes and returns a pending internal signal.

Returns None if there are no signals pending.

Source§

impl<'guard, G: 'guard + Deref<Target = ThreadGroupMutableState>> Guard<'guard, ThreadGroup, G>

Source

pub fn leader(&self) -> pid_t

Source

pub fn leader_command(&self) -> TaskCommand

Source

pub fn is_terminating(&self) -> bool

Source

pub fn children(&self) -> impl Iterator<Item = Arc<ThreadGroup>> + '_

Source

pub fn tasks(&self) -> impl Iterator<Item = TempRef<'_, Task>> + '_

Source

pub fn task_ids(&self) -> impl Iterator<Item = &tid_t>

Source

pub fn contains_task(&self, tid: tid_t) -> bool

Source

pub fn get_task(&self, tid: tid_t) -> Option<TempRef<'_, Task>>

Source

pub fn tasks_count(&self) -> usize

Source

pub fn get_ppid(&self) -> pid_t

Source

pub fn is_waitable(&self) -> bool

Indicates whether the thread group is waitable via waitid and waitpid for either WSTOPPED or WCONTINUED.

Source

pub fn is_correct_exit_signal( for_clone: bool, exit_code: Option<Signal>, ) -> bool

Source

pub fn get_live_task(&self) -> Result<TempRef<'_, Task>, Errno>

Returns a task in the current thread group.

Source§

impl<'guard, G: 'guard + DerefMut<Target = ThreadGroupMutableState>> Guard<'guard, ThreadGroup, G>

Source

pub fn get_waitable_zombie( &mut self, zombie_list: &dyn Fn(&mut ThreadGroupMutableState) -> &mut Vec<OwnedRef<ZombieProcess>>, selector: &ProcessSelector, options: &WaitingOptions, pids: &mut PidTable, ) -> Option<WaitResult>

Source

pub fn get_waitable_child( &mut self, selector: &ProcessSelector, options: &WaitingOptions, pids: &mut PidTable, ) -> WaitableChildResult

Returns any waitable child matching the given selector and options. Returns None if no child matching the selector is waitable. Returns ECHILD if no child matches the selector at all.

Will remove the waitable status from the child depending on options.

Source

pub fn set_stopped( self, new_stopped: StopState, siginfo: Option<SignalInfo>, finalize_only: bool, ) -> StopState

Set the stop status of the process. If you pass |siginfo| of |None|, does not update the signal. If |finalize_only| is set, will check that the set will be a finalize (Stopping -> Stopped or Stopped -> Stopped) before executing it.

Returns the latest stop state after any changes.

Source

pub fn send_signal(self, signal_info: SignalInfo)

Sends the signal signal_info to this thread group.

Source§

impl<'guard, G: 'guard + Deref<Target = DirEntryState>> Guard<'guard, DirEntry, G>

Source

pub fn local_name(&self) -> &FsStr

Source

pub fn parent(&self) -> &Option<DirEntryHandle>

Source

pub fn is_dead(&self) -> bool

Whether this directory entry has been removed from the tree.

Source§

impl<'guard, G: 'guard + Deref<Target = MountState>> Guard<'guard, Arc<Mount>, G>

Source

pub fn is_shared(&self) -> bool

Is the mount in a peer group? Corresponds to MS_SHARED.

Source§

impl<'guard, G: 'guard + DerefMut<Target = MountState>> Guard<'guard, Arc<Mount>, G>

Source

pub fn make_shared(&mut self)

Put the mount in a peer group. Implements MS_SHARED.

Source

pub fn make_private(&mut self)

Take the mount out of its peer group, also remove upstream if any. Implements MS_PRIVATE.

Source

pub fn make_downstream(&mut self)

Take the mount out of its peer group and make it downstream instead. Implements MountFlags::DOWNSTREAM (MS_SLAVE).

Trait Implementations§

Source§

impl<'a, B, S, G: Deref<Target = S>> Deref for Guard<'a, B, G>

Source§

type Target = S

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<'a, B, S, G: DerefMut<Target = S>> DerefMut for Guard<'a, B, G>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a, B, G> Freeze for Guard<'a, B, G>
where G: Freeze,

§

impl<'a, B, G> RefUnwindSafe for Guard<'a, B, G>

§

impl<'a, B, G> Send for Guard<'a, B, G>
where G: Send, B: Sync,

§

impl<'a, B, G> Sync for Guard<'a, B, G>
where G: Sync, B: Sync,

§

impl<'a, B, G> Unpin for Guard<'a, B, G>
where G: Unpin,

§

impl<'a, B, G> UnwindSafe for Guard<'a, B, G>

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, P> FileOps for P
where T: FileOps + CloseFreeSafe, P: Deref<Target = T> + Send + Sync + 'static,

Source§

fn close( self: Box<P>, _locked: &mut Locked<FileOpsCore>, _file: &FileObjectState, _current_task: &CurrentTask, )

Called when the FileObject is destroyed.
Source§

fn flush( &self, locked: &mut Locked<FileOpsCore>, file: &FileObject, current_task: &CurrentTask, )

Called every time close() is called on this file, even if the file is not ready to be released.
Source§

fn has_persistent_offsets(&self) -> bool

Returns whether the file has meaningful seek offsets. Returning false is only optimization and will makes FileObject never hold the offset lock when calling read and write.
Source§

fn writes_update_seek_offset(&self) -> bool

Returns true if write() operations on the file will update the seek offset.
Source§

fn is_seekable(&self) -> bool

Returns whether the file is seekable.
Source§

fn read( &self, locked: &mut Locked<FileOpsCore>, file: &FileObject, current_task: &CurrentTask, offset: usize, data: &mut dyn OutputBuffer, ) -> Result<usize, Errno>

Read from the file at an offset. If the file does not have persistent offsets (either directly, or because it is not seekable), offset will be 0 and can be ignored. Returns the number of bytes read.
Source§

fn write( &self, locked: &mut Locked<FileOpsCore>, file: &FileObject, current_task: &CurrentTask, offset: usize, data: &mut dyn InputBuffer, ) -> Result<usize, Errno>

Write to the file with an offset. If the file does not have persistent offsets (either directly, or because it is not seekable), offset will be 0 and can be ignored. Returns the number of bytes written.
Source§

fn seek( &self, locked: &mut Locked<FileOpsCore>, file: &FileObject, current_task: &CurrentTask, current_offset: i64, target: SeekTarget, ) -> Result<i64, Errno>

Adjust the current_offset if the file is seekable.
Source§

fn sync( &self, file: &FileObject, current_task: &CurrentTask, ) -> Result<(), Errno>

Syncs cached state associated with the file descriptor to persistent storage. Read more
Source§

fn data_sync( &self, file: &FileObject, current_task: &CurrentTask, ) -> Result<(), Errno>

Syncs cached data, and only enough metadata to retrieve said data, to persistent storage. Read more
Source§

fn get_memory( &self, locked: &mut Locked<FileOpsCore>, file: &FileObject, current_task: &CurrentTask, length: Option<usize>, prot: ProtectionFlags, ) -> Result<Arc<MemoryObject>, Errno>

Returns a VMO representing this file. At least the requested protection flags must be set on the VMO. Reading or writing the VMO must read or write the file. If this is not possible given the requested protection, an error must be returned. The length is a hint for the desired size of the VMO. The returned VMO may be larger or smaller than the requested length. This method is typically called by Self::mmap.
Source§

fn mmap( &self, locked: &mut Locked<FileOpsCore>, file: &FileObject, current_task: &CurrentTask, addr: DesiredAddress, memory_offset: u64, length: usize, prot_flags: ProtectionFlags, options: MappingOptions, filename: NamespaceNode, ) -> Result<UserAddress, Errno>

Responds to an mmap call. The default implementation calls Self::get_memory to get a VMO and then maps it with [crate::mm::MemoryManager::map]. Only implement this trait method if your file needs to control mapping, or record where a VMO gets mapped.
Source§

fn readdir( &self, locked: &mut Locked<FileOpsCore>, file: &FileObject, current_task: &CurrentTask, sink: &mut dyn DirentSink, ) -> Result<(), Errno>

Respond to a getdents or getdents64 calls. Read more
Source§

fn wait_async( &self, locked: &mut Locked<FileOpsCore>, file: &FileObject, current_task: &CurrentTask, waiter: &Waiter, events: FdEvents, handler: EventHandler, ) -> Option<WaitCanceler>

Establish a one-shot, edge-triggered, asynchronous wait for the given FdEvents for the given file and task. Returns None if this file does not support blocking waits. Read more
Source§

fn query_events( &self, locked: &mut Locked<FileOpsCore>, file: &FileObject, current_task: &CurrentTask, ) -> Result<FdEvents, Errno>

The events currently active on this file. Read more
Source§

fn ioctl( &self, locked: &mut Locked<Unlocked>, file: &FileObject, current_task: &CurrentTask, request: u32, arg: SyscallArg, ) -> Result<SyscallResult, Errno>

Source§

fn fcntl( &self, file: &FileObject, current_task: &CurrentTask, cmd: u32, arg: u64, ) -> Result<SyscallResult, Errno>

Source§

fn to_handle( &self, file: &FileObject, current_task: &CurrentTask, ) -> Result<Option<NullableHandle>, Errno>

Return a handle that allows access to this file descritor through the zxio protocols. Read more
Source§

fn as_thread_group_key( &self, file: &FileObject, ) -> Result<ThreadGroupKey, Errno>

Returns the associated pid_t. Read more
Source§

fn readahead( &self, file: &FileObject, current_task: &CurrentTask, offset: usize, length: usize, ) -> Result<(), Errno>

Source§

fn extra_fdinfo( &self, locked: &mut Locked<FileOpsCore>, file: &Arc<ObjectReleaser<FileObject, FileObjectReleaserAction>>, current_task: &CurrentTask, ) -> Option<BString>

Extra information that is included in the /proc//fdfino/ entry.
Source§

fn open( &self, _locked: &mut Locked<FileOpsCore>, _file: &FileObject, _current_task: &CurrentTask, ) -> Result<(), Errno>

Called when the FileObject is opened/created
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<R> Rng for R
where R: RngCore + ?Sized,

Source§

fn random<T>(&mut self) -> T

Return a random value via the StandardUniform distribution. Read more
Source§

fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>

Return an iterator over random variates Read more
Source§

fn random_range<T, R>(&mut self, range: R) -> T
where T: SampleUniform, R: SampleRange<T>,

Generate a random value in the given range. Read more
Source§

fn random_bool(&mut self, p: f64) -> bool

Return a bool with a probability p of being true. Read more
Source§

fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool

Return a bool with a probability of numerator/denominator of being true. Read more
Source§

fn sample<T, D>(&mut self, distr: D) -> T
where D: Distribution<T>,

Sample a new value, using the given distribution. Read more
Source§

fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>
where D: Distribution<T>, Self: Sized,

Create an iterator that generates values using the given distribution. Read more
Source§

fn fill<T>(&mut self, dest: &mut T)
where T: Fill + ?Sized,

Fill any type implementing Fill with random data Read more
Source§

fn gen<T>(&mut self) -> T

👎Deprecated since 0.9.0: Renamed to random to avoid conflict with the new gen keyword in Rust 2024.
Alias for Rng::random.
Source§

fn gen_range<T, R>(&mut self, range: R) -> T
where T: SampleUniform, R: SampleRange<T>,

👎Deprecated since 0.9.0: Renamed to random_range
Source§

fn gen_bool(&mut self, p: f64) -> bool

👎Deprecated since 0.9.0: Renamed to random_bool
Alias for Rng::random_bool.
Source§

fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool

👎Deprecated since 0.9.0: Renamed to random_ratio
Source§

impl<T> RngCore for T
where T: DerefMut, <T as Deref>::Target: RngCore,

Source§

fn next_u32(&mut self) -> u32

Return the next random u32. Read more
Source§

fn next_u64(&mut self) -> u64

Return the next random u64. Read more
Source§

fn fill_bytes(&mut self, dst: &mut [u8])

Fill dest with random data. Read more
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.
Source§

impl<R> TryRngCore for R
where R: RngCore + ?Sized,

Source§

type Error = Infallible

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

fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>

Return the next random u32.
Source§

fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>

Return the next random u64.
Source§

fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>

Fill dest entirely with random data.
Source§

fn unwrap_err(self) -> UnwrapErr<Self>
where Self: Sized,

Wrap RNG with the UnwrapErr wrapper.
Source§

fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>

Wrap RNG with the UnwrapMut wrapper.
Source§

fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>
where Self: Sized,

Convert an RngCore to a RngReadAdapter.
§

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<T> CryptoRng for T
where T: DerefMut, <T as Deref>::Target: CryptoRng,

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>,

Source§

impl<R> TryCryptoRng for R
where R: CryptoRng + ?Sized,