Kernel: Handle TTY ioctls on all inodes not implementing it

This reduces debug spam while compiling software
This commit is contained in:
2026-05-20 16:55:08 +03:00
parent 6045726e41
commit 14aa28b043
3 changed files with 17 additions and 18 deletions

View File

@@ -35,8 +35,6 @@ namespace Kernel
virtual bool has_error_impl() const override { return m_reading_count == 0; }
virtual bool has_hungup_impl() const override { return m_writing_count == 0; }
virtual BAN::ErrorOr<long> ioctl_impl(int, void*) override;
private:
Pipe(const struct stat&);

View File

@@ -5,6 +5,7 @@
#include <kernel/Memory/FileBackedRegion.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/statvfs.h>
namespace Kernel
@@ -317,7 +318,22 @@ namespace Kernel
BAN::ErrorOr<long> Inode::ioctl(int request, void* arg)
{
return ioctl_impl(request, arg);
auto ret = ioctl_impl(request, arg);
if (!ret.is_error() || ret.error().get_error_code() != ENOTSUP)
return BAN::move(ret);
switch (request)
{
case TIOCGWINSZ:
case TIOCSWINSZ:
case TCGETS:
case TCSETS:
case TCSETSW:
case TCSETSF:
return BAN::Error::from_errno(EINVAL);
default:
return BAN::Error::from_errno(ENOTSUP);
}
}
BAN::ErrorOr<void> Inode::add_epoll(class Epoll* epoll)

View File

@@ -268,19 +268,4 @@ namespace Kernel
return BAN::Error::from_errno(ENODEV);
}
BAN::ErrorOr<long> Pipe::ioctl_impl(int cmd, void* arg)
{
switch (cmd)
{
case TIOCGWINSZ:
case TIOCSWINSZ:
case TCGETS:
case TCSETS:
case TCSETSW:
case TCSETSF:
return BAN::Error::from_errno(EINVAL);
}
return Inode::ioctl_impl(cmd, arg);
}
}