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:
parent
33d2ecdd79
commit
2ac5c2278d
1 changed files with 9 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue