Kernel: Add some functionality to disable TTY input/output
Userspace programs can call tty_ctrl() to disable/enable tty from handling input and displaying output. This API is probably going to change in the future to ioctl calls but I'm not sure how ioctl is used and what functionality should it have. I decided to create whole new function and syscall for now. Next I will expose framebuffer in /dev/fb0 and then I can start work on graphical environment! :D
This commit is contained in:
@@ -21,6 +21,8 @@ namespace Kernel
|
||||
void set_foreground_pgrp(pid_t pgrp) { m_foreground_pgrp = pgrp; }
|
||||
pid_t foreground_pgrp() const { return m_foreground_pgrp; }
|
||||
|
||||
BAN::ErrorOr<void> tty_ctrl(int command, int flags);
|
||||
|
||||
// for kprint
|
||||
static void putchar_current(uint8_t ch);
|
||||
static bool is_initialized();
|
||||
@@ -35,7 +37,8 @@ namespace Kernel
|
||||
|
||||
virtual uint32_t height() const = 0;
|
||||
virtual uint32_t width() const = 0;
|
||||
virtual void putchar(uint8_t ch) = 0;
|
||||
void putchar(uint8_t ch);
|
||||
virtual void putchar_impl(uint8_t ch) = 0;
|
||||
|
||||
bool has_data() const;
|
||||
|
||||
@@ -62,6 +65,14 @@ namespace Kernel
|
||||
private:
|
||||
pid_t m_foreground_pgrp { 0 };
|
||||
|
||||
struct tty_ctrl_t
|
||||
{
|
||||
bool draw_graphics { true };
|
||||
bool receive_input { true };
|
||||
Semaphore semaphore;
|
||||
};
|
||||
tty_ctrl_t m_tty_ctrl;
|
||||
|
||||
struct Buffer
|
||||
{
|
||||
BAN::Array<uint8_t, 1024> buffer;
|
||||
|
||||
Reference in New Issue
Block a user