1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

UserspaceEmulator: Support ioctl(TIOCGWINSZ)

This is very commonly used by terminal programs, and easy to support.
This commit is contained in:
Andreas Kling 2020-07-27 23:38:50 +02:00
parent 33d2ecdd79
commit 2ac5c2278d

View file

@ -36,6 +36,7 @@
#include <serenity.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/select.h>
#include <sys/socket.h>
@ -864,6 +865,14 @@ int Emulator::virt$ioctl(int fd, unsigned request, FlatPtr arg)
{
(void)fd;
(void)arg;
if (request == TIOCGWINSZ) {
struct winsize ws;
int rc = syscall(SC_ioctl, fd, TIOCGWINSZ, &ws);
if (rc < 0)
return rc;
mmu().copy_to_vm(arg, &ws, sizeof(winsize));
return 0;
}
dbg() << "Unsupported ioctl: " << request;
dump_backtrace();
TODO();