mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +00:00
Kernel/TTY: Implement TIOCGPTN ioctl for MasterPTY
This ioctl operation will allow userspace to determine the index number of a MasterPTY after opening /dev/ptmx and actually getting an internal file descriptor of MasterPTY.
This commit is contained in:
parent
e508073168
commit
5ffe2f117c
2 changed files with 12 additions and 2 deletions
|
@ -125,9 +125,17 @@ ErrorOr<void> MasterPTY::ioctl(OpenFileDescription& description, unsigned reques
|
|||
TRY(Process::current().require_promise(Pledge::tty));
|
||||
if (!m_slave)
|
||||
return EIO;
|
||||
if (request == TIOCSWINSZ || request == TIOCGPGRP)
|
||||
switch (request) {
|
||||
case TIOCGPTN: {
|
||||
int master_pty_index = index();
|
||||
return copy_to_user(static_ptr_cast<int*>(arg), &master_pty_index);
|
||||
}
|
||||
case TIOCSWINSZ:
|
||||
case TIOCGPGRP:
|
||||
return m_slave->ioctl(description, request, arg);
|
||||
return EINVAL;
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<KString>> MasterPTY::pseudo_path(const OpenFileDescription&) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue