mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 03:58:12 +00:00
Kernel: Remove KDSETMODE and KDGETMODE ioctl options from the TTY class
These options are not relevant and are actually meaningless on pure TTY devices, as they are meant to be effective only for the VirtualConsole devices. This also removes the virtual marking from two methods because they're no longer declared in the TTY class as well.
This commit is contained in:
parent
258af88b29
commit
4177e6be8b
4 changed files with 25 additions and 20 deletions
|
@ -194,6 +194,27 @@ UNMAP_AFTER_INIT VirtualConsole::~VirtualConsole()
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
ErrorOr<void> VirtualConsole::ioctl(OpenFileDescription& description, unsigned request, Userspace<void*> arg)
|
||||
{
|
||||
TRY(Process::current().require_promise(Pledge::tty));
|
||||
switch (request) {
|
||||
case KDSETMODE: {
|
||||
auto mode = static_cast<unsigned int>(arg.ptr());
|
||||
if (mode != KD_TEXT && mode != KD_GRAPHICS)
|
||||
return EINVAL;
|
||||
|
||||
set_graphical(mode == KD_GRAPHICS);
|
||||
return {};
|
||||
}
|
||||
case KDGETMODE: {
|
||||
auto mode_ptr = static_ptr_cast<int*>(arg);
|
||||
int mode = (is_graphical()) ? KD_GRAPHICS : KD_TEXT;
|
||||
return copy_to_user(mode_ptr, &mode);
|
||||
}
|
||||
}
|
||||
return TTY::ioctl(description, request, arg);
|
||||
}
|
||||
|
||||
static inline Graphics::Console::Color ansi_color_to_standard_vga_color(VT::Color::ANSIColor color)
|
||||
{
|
||||
switch (color) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue