UserspaceEmulator: Support ioctl(TCGETS) and ioctl(TCSETS)

This commit is contained in:
Andreas Kling 2020-08-05 19:51:44 +02:00
parent e0e3e5b9b1
commit d608d714b9
Notes: sideshowbarker 2024-07-19 04:15:07 +09:00

View file

@ -42,6 +42,7 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <termios.h>
#include <unistd.h>
#if defined(__GNUC__) && !defined(__clang__)
@ -905,6 +906,22 @@ int Emulator::virt$ioctl(int fd, unsigned request, FlatPtr arg)
if (request == TIOCSPGRP) {
return syscall(SC_ioctl, fd, request, arg);
}
if (request == TCGETS) {
struct termios termios;
int rc = syscall(SC_ioctl, fd, request, &termios);
if (rc < 0)
return rc;
mmu().copy_to_vm(arg, &termios, sizeof(termios));
return rc;
}
if (request == TCSETS) {
struct termios termios;
mmu().copy_from_vm(&termios, arg, sizeof(termios));
int rc = syscall(SC_ioctl, fd, request, &termios);
if (rc < 0)
return rc;
return rc;
}
dbg() << "Unsupported ioctl: " << request;
dump_backtrace();
TODO();