Add shared memory, keyboard events and PTY syscall

This commit is contained in:
Mark Poliakov 2024-01-04 21:23:19 +02:00
parent bd349c40e2
commit fba21b5743
3 changed files with 23 additions and 1 deletions

View File

@ -212,8 +212,9 @@ impl KeyboardKey {
}
impl KeyboardKeyEvent {
/// Splits the event into its state and key
#[inline]
const fn split(self) -> (KeyboardKey, bool) {
pub const fn split(self) -> (KeyboardKey, bool) {
match self {
Self::Pressed(k) => (k, true),
Self::Released(k) => (k, false),

View File

@ -117,4 +117,19 @@ impl TerminalOptions {
pub const fn is_canonical(&self) -> bool {
self.line.contains(TerminalLineOptions::CANONICAL)
}
/// Returns `true` if the terminal echoes the '\n' character
pub fn is_echo_newline(&self) -> bool {
self.line.contains_any(
TerminalLineOptions::CANONICAL
| TerminalLineOptions::ECHO
| TerminalLineOptions::ECHO_NL,
)
}
}
impl Default for TerminalOptions {
fn default() -> Self {
Self::const_default()
}
}

View File

@ -50,6 +50,12 @@ primitive_enum!(
#[doc = "Send a message to a channel"]
SendMessage = 22,
#[doc = "Creates a buffer of shared memory and returns a FD to it"]
CreateSharedMemory = 23,
#[doc = "Creates a pair of pseudo-terminal master/slave"]
CreatePty = 24,
#[doc = "Create and start a new process"]
SpawnProcess = 40,
#[doc = "Wait for a process to exit"]