diff --git a/kernel/kernel/Terminal/TTY.cpp b/kernel/kernel/Terminal/TTY.cpp index 1a241f3aab..fcce60d645 100644 --- a/kernel/kernel/Terminal/TTY.cpp +++ b/kernel/kernel/Terminal/TTY.cpp @@ -127,16 +127,22 @@ namespace Kernel { switch (request) { - case KD_LOADFONT: + case KDLOADFONT: { auto absolute_path = TRY(Process::current().absolute_path_of(BAN::StringView(reinterpret_cast(argument)))); auto new_font = TRY(LibFont::Font::load(absolute_path)); set_font(new_font); return 0; } - default: - return BAN::Error::from_errno(EINVAL); + case TIOCGWINSZ: + { + auto* winsize = static_cast(argument); + winsize->ws_col = width(); + winsize->ws_row = height(); + return 0; + } } + return BAN::Error::from_errno(ENOTSUP); } void TTY::on_key_event(LibInput::KeyEvent event) diff --git a/userspace/libraries/LibC/include/stropts.h b/userspace/libraries/LibC/include/stropts.h index 76261ccf06..87eeb5007e 100644 --- a/userspace/libraries/LibC/include/stropts.h +++ b/userspace/libraries/LibC/include/stropts.h @@ -101,7 +101,14 @@ struct str_list #define I_SWROPT 28 #define I_UNLINK 29 -#define KD_LOADFONT 30 +#define KDLOADFONT 30 + +struct winsize +{ + unsigned short ws_row; + unsigned short ws_col; +}; +#define TIOCGWINSZ 50 #define FLUSHR 1 #define FLUSHRW 2 diff --git a/userspace/programs/loadfont/main.cpp b/userspace/programs/loadfont/main.cpp index 03d28f0b01..91b977a817 100644 --- a/userspace/programs/loadfont/main.cpp +++ b/userspace/programs/loadfont/main.cpp @@ -20,7 +20,7 @@ int main(int argc, char** argv) return 1; } - if (ioctl(STDOUT_FILENO, KD_LOADFONT, argv[1]) == -1) + if (ioctl(STDOUT_FILENO, KDLOADFONT, argv[1]) == -1) { perror("ioctl"); return 1;