Kernel/LibC: Rework TIOC{G,S}WINSZ more linux like

Userspace can freely set terminal size, kernel just updates it when for
example new font is loaded. Also SIGWINCH is now sent by kernel instead
of userspace.
This commit is contained in:
2025-06-28 19:40:54 +03:00
parent 521457eb92
commit e8491b34b8
12 changed files with 62 additions and 77 deletions
+5 -3
View File
@@ -8,6 +8,7 @@
#include <LibInput/KeyEvent.h>
#include <termios.h>
#include <sys/ioctl.h>
namespace Kernel
{
@@ -53,9 +54,6 @@ namespace Kernel
virtual bool is_tty() const override { return true; }
virtual uint32_t height() const = 0;
virtual uint32_t width() const = 0;
virtual dev_t rdev() const final override { return m_rdev; }
virtual void clear() = 0;
@@ -80,6 +78,8 @@ namespace Kernel
virtual BAN::ErrorOr<size_t> read_impl(off_t, BAN::ByteSpan) final override;
virtual BAN::ErrorOr<size_t> write_impl(off_t, BAN::ConstByteSpan) final override;
void update_winsize(unsigned short cols, unsigned short rows);
private:
bool putchar(uint8_t ch);
void do_backspace();
@@ -109,6 +109,8 @@ namespace Kernel
};
Buffer m_output;
winsize m_winsize {};
protected:
RecursiveSpinLock m_write_lock;
ThreadBlocker m_write_blocker;