pub struct Terminal {
pub dev_pts_root: DirEntryHandle,
pub fscred: FsCred,
pub id: u32,
/* private fields */
}Expand description
State of a given terminal. This object handles both the main and the replica terminal.
Fields§
§dev_pts_root: DirEntryHandleThe root of the devpts fs responsible for this terminal.
fscred: FsCredThe owner of the terminal.
id: u32The identifier of the terminal.
Implementations§
Source§impl Terminal
impl Terminal
pub fn new( state: Arc<TtyState>, dev_pts_root: DirEntryHandle, fscred: FsCred, id: u32, ) -> Arc<Self> ⓘ
pub fn to_owned(&self) -> Arc<Terminal> ⓘ
Sourcepub fn set_termios(&self, termios: termios2)
pub fn set_termios(&self, termios: termios2)
Sets the terminal configuration.
pub fn flush(&self, is_main: bool, arg: u32) -> Result<(), Errno>
Sourcepub fn main_close(&self)
pub fn main_close(&self)
close implementation of the main side of the terminal.
Sourcepub fn main_wait_async(
&self,
waiter: &Waiter,
events: FdEvents,
handler: EventHandler,
) -> WaitCanceler
pub fn main_wait_async( &self, waiter: &Waiter, events: FdEvents, handler: EventHandler, ) -> WaitCanceler
wait_async implementation of the main side of the terminal.
Sourcepub fn main_query_events(&self) -> FdEvents
pub fn main_query_events(&self) -> FdEvents
query_events implementation of the main side of the terminal.
Sourcepub fn main_read(&self, data: &mut dyn OutputBuffer) -> Result<usize, Errno>
pub fn main_read(&self, data: &mut dyn OutputBuffer) -> Result<usize, Errno>
read implementation of the main side of the terminal.
Sourcepub fn main_write(&self, data: &mut dyn InputBuffer) -> Result<usize, Errno>
pub fn main_write(&self, data: &mut dyn InputBuffer) -> Result<usize, Errno>
write implementation of the main side of the terminal.
Sourcepub fn replica_close(&self)
pub fn replica_close(&self)
close implementation of the replica side of the terminal.
Sourcepub fn replica_open(&self)
pub fn replica_open(&self)
Called when a new reference to the replica side of this terminal is made.
Sourcepub fn replica_wait_async(
&self,
waiter: &Waiter,
events: FdEvents,
handler: EventHandler,
) -> WaitCanceler
pub fn replica_wait_async( &self, waiter: &Waiter, events: FdEvents, handler: EventHandler, ) -> WaitCanceler
wait_async implementation of the replica side of the terminal.
Sourcepub fn replica_query_events(&self) -> FdEvents
pub fn replica_query_events(&self) -> FdEvents
query_events implementation of the replica side of the terminal.
Sourcepub fn replica_read(&self, data: &mut dyn OutputBuffer) -> Result<usize, Errno>
pub fn replica_read(&self, data: &mut dyn OutputBuffer) -> Result<usize, Errno>
read implementation of the replica side of the terminal.
Sourcepub fn replica_write(&self, data: &mut dyn InputBuffer) -> Result<usize, Errno>
pub fn replica_write(&self, data: &mut dyn InputBuffer) -> Result<usize, Errno>
write implementation of the replica side of the terminal.
Sourcepub fn disassociate_controlling_session(&self)
pub fn disassociate_controlling_session(&self)
Disassociates the controlling session from the terminal.
Clears the controlling session, clears controlling_terminal on all member
thread groups in the session, and sends SIGHUP and SIGCONT to the foreground
process group outside of any terminal locks.
Sourcepub fn disassociate_controlling_session_if(
&self,
expected_session: Option<&Pid>,
side: Option<TerminalSide>,
)
pub fn disassociate_controlling_session_if( &self, expected_session: Option<&Pid>, side: Option<TerminalSide>, )
Disassociates the controlling session from the terminal if expected_session matches
(or is None), clearing matching member controlling_terminal references and sending
SIGHUP and SIGCONT to the foreground process group outside of any terminal locks.
Sourcepub fn send_signals(&self, signals: &[Signal])
pub fn send_signals(&self, signals: &[Signal])
Sends the specified signals to the foreground process group of this terminal.
The terminal state lock is held only to extract the foreground PID and is dropped before signal dispatch to prevent lock inversion with ThreadGroup locks.
pub fn device(&self) -> DeviceId
pub fn read<'a>(self: &'a Terminal) -> TerminalReadGuard<'a>
pub fn write<'a>(self: &'a Terminal) -> TerminalWriteGuard<'a>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Terminal
impl !RefUnwindSafe for Terminal
impl !UnwindSafe for Terminal
impl Send for Terminal
impl Sync for Terminal
impl Unpin for Terminal
impl UnsafeUnpin for Terminal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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