mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:08:12 +00:00
Kernel: Support userspace TTY graphics modesetting
This is a copy of linux's KDSETMODE/KDGETMODE console ioctl(2) interface.
This commit is contained in:
parent
bc4a0baa8f
commit
4b0be17c71
4 changed files with 28 additions and 2 deletions
|
@ -562,6 +562,19 @@ ErrorOr<void> TTY::ioctl(OpenFileDescription&, unsigned request, Userspace<void*
|
|||
case TIOCNOTTY:
|
||||
current_process.set_tty(nullptr);
|
||||
return {};
|
||||
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 EINVAL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue