⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

PtyMasterNode

Struct PtyMasterNode 

Source
pub struct PtyMasterNode { /* private fields */ }
Expand description

VfsNode adapter for the master side of a PTY.

Reading from this node returns bytes that the slave has written (i.e. the program’s output). Writing to this node delivers bytes to the slave’s input buffer (i.e. simulates keyboard input).

Implementations§

Source§

impl PtyMasterNode

Source

pub fn new(master: Arc<PtyMaster>) -> Self

Wrap an existing PtyMaster as a VfsNode.

Source

pub fn pty_id(&self) -> u32

Return the PTY ID owned by this master node.

Trait Implementations§

Source§

impl VfsNode for PtyMasterNode

Source§

fn read(&self, _offset: usize, buffer: &mut [u8]) -> Result<usize, KernelError>

Read bytes produced by the slave (the program’s stdout/stderr).

Source§

fn write(&self, _offset: usize, data: &[u8]) -> Result<usize, KernelError>

Write bytes that the slave will read (simulate keyboard input).

Source§

fn node_type(&self) -> NodeType

Node type query (also serves as vtable slot padding for AArch64)
Source§

fn metadata(&self) -> Result<Metadata, KernelError>

Get metadata for the node
Source§

fn readdir(&self) -> Result<Vec<DirEntry>, KernelError>

List directory entries (if this is a directory)
Source§

fn lookup(&self, _name: &str) -> Result<Arc<dyn VfsNode>, KernelError>

Look up a child node by name (if this is a directory)
Source§

fn create( &self, _name: &str, _permissions: Permissions, ) -> Result<Arc<dyn VfsNode>, KernelError>

Create a new file in this directory
Source§

fn mkdir( &self, _name: &str, _permissions: Permissions, ) -> Result<Arc<dyn VfsNode>, KernelError>

Create a new directory in this directory
Remove a file or empty directory
Source§

fn truncate(&self, _size: usize) -> Result<(), KernelError>

Truncate the file to the specified size
Create a hard link to this node
Create a symbolic link in this directory. Read more
Read the target of a symbolic link. Read more
Source§

fn chmod(&self, _permissions: Permissions) -> Result<(), KernelError>

Change permissions on this node
Source§

fn poll_readiness(&self) -> u16

Poll readiness for I/O multiplexing (poll/epoll). Read more
Source§

fn as_any(&self) -> Option<&dyn Any>

Downcast to &dyn core::any::Any for type-specific operations. Read more

Auto Trait Implementations§

§

impl Freeze for PtyMasterNode

§

impl !RefUnwindSafe for PtyMasterNode

§

impl Send for PtyMasterNode

§

impl Sync for PtyMasterNode

§

impl Unpin for PtyMasterNode

§

impl !UnwindSafe for PtyMasterNode

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.