From 946c96dd5696116048097340db86a26ce9aa7a58 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Wed, 5 Aug 2020 02:13:30 -0700 Subject: [PATCH] Kernel: Suppress remaining unobserved KResult return codes These are all cases where there is no clear and easy fix, I've left FIXME bread crumbs so that these can hopefully be fixed over time. --- Kernel/FileSystem/Ext2FileSystem.cpp | 4 +++- Kernel/FileSystem/FileDescription.cpp | 3 ++- Kernel/FileSystem/Plan9FileSystem.cpp | 9 ++++++--- Kernel/Net/TCPSocket.cpp | 3 ++- Kernel/Scheduler.cpp | 3 ++- Kernel/Syscalls/execve.cpp | 3 ++- Kernel/TTY/TTY.cpp | 13 ++++++------- 7 files changed, 23 insertions(+), 15 deletions(-) diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 2ae94dbc1d..b537eb4df8 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -1477,11 +1477,13 @@ void Ext2FSInode::populate_lookup_cache() const return; HashMap children; - traverse_as_directory([&children](auto& entry) { + KResult result = traverse_as_directory([&children](auto& entry) { children.set(String(entry.name, entry.name_length), entry.inode.index()); return true; }); + ASSERT(result.is_success()); + if (!m_lookup_cache.is_empty()) return; m_lookup_cache = move(children); diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp index c47699ebea..662176ddf4 100644 --- a/Kernel/FileSystem/FileDescription.cpp +++ b/Kernel/FileSystem/FileDescription.cpp @@ -70,7 +70,8 @@ FileDescription::~FileDescription() socket()->detach(*this); if (is_fifo()) static_cast(m_file.ptr())->detach(m_fifo_direction); - m_file->close(); + // FIXME: Should this error path be observed somehow? + (void)m_file->close(); m_inode = nullptr; } diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp index ddd2c6b9aa..de7c5fd3e3 100644 --- a/Kernel/FileSystem/Plan9FileSystem.cpp +++ b/Kernel/FileSystem/Plan9FileSystem.cpp @@ -636,7 +636,8 @@ Plan9FSInode::~Plan9FSInode() { Plan9FS::Message clunk_request { fs(), Plan9FS::Message::Type::Tclunk }; clunk_request << fid(); - fs().post_message_and_explicitly_ignore_reply(clunk_request); + // FIXME: Should we observe this error somehow? + (void)fs().post_message_and_explicitly_ignore_reply(clunk_request); } KResult Plan9FSInode::ensure_open_for_mode(int mode) @@ -829,7 +830,8 @@ KResult Plan9FSInode::traverse_as_directory(Function socket) { ASSERT(m_pending_release_for_accept.contains(socket->tuple())); m_pending_release_for_accept.remove(socket->tuple()); - queue_connection_from(*socket); + // FIXME: Should we observe this error somehow? + (void)queue_connection_from(*socket); } TCPSocket::TCPSocket(int protocol) diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 049002836e..976a8f18ca 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -384,7 +384,8 @@ bool Scheduler::pick_next() } if (process.m_alarm_deadline && g_uptime > process.m_alarm_deadline) { process.m_alarm_deadline = 0; - process.send_signal(SIGALRM, nullptr); + // FIXME: Should we observe this signal somehow? + (void)process.send_signal(SIGALRM, nullptr); } return IterationDecision::Continue; }); diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index f5d6c552cf..a74dd301e4 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -246,7 +246,8 @@ int Process::do_exec(NonnullRefPtr main_program_description, Ve for (size_t i = 0; i < m_fds.size(); ++i) { auto& description_and_flags = m_fds[i]; if (description_and_flags.description() && description_and_flags.flags() & FD_CLOEXEC) { - description_and_flags.description()->close(); + // FIXME: Should this error path be observed somehow? + (void)description_and_flags.description()->close(); description_and_flags = {}; } } diff --git a/Kernel/TTY/TTY.cpp b/Kernel/TTY/TTY.cpp index 589149e259..1743bf86d2 100644 --- a/Kernel/TTY/TTY.cpp +++ b/Kernel/TTY/TTY.cpp @@ -55,9 +55,8 @@ void TTY::set_default_termios() KResultOr TTY::read(FileDescription&, size_t, u8* buffer, size_t size) { if (Process::current()->pgid() != pgid()) { - KResult result = Process::current()->send_signal(SIGTTIN, nullptr); - if (result.is_error()) - return result; + // FIXME: Should we propigate this error path somehow? + (void)Process::current()->send_signal(SIGTTIN, nullptr); return KResult(-EINTR); } @@ -93,9 +92,8 @@ KResultOr TTY::read(FileDescription&, size_t, u8* buffer, size_t size) KResultOr TTY::write(FileDescription&, size_t, const u8* buffer, size_t size) { if (Process::current()->pgid() != pgid()) { - KResult result = Process::current()->send_signal(SIGTTOU, nullptr); - if (result.is_error()) - return result; + // FIXME: Should we propigate this error path somehow? + (void)Process::current()->send_signal(SIGTTOU, nullptr); return KResult(-EINTR); } @@ -255,7 +253,8 @@ void TTY::generate_signal(int signal) InterruptDisabler disabler; // FIXME: Iterate over a set of process handles instead? Process::for_each_in_pgrp(pgid(), [&](auto& process) { dbg() << tty_name() << ": Send signal " << signal << " to " << process; - process.send_signal(signal, nullptr); + // FIXME: Should this error be propagated somehow? + (void)process.send_signal(signal, nullptr); return IterationDecision::Continue; }); }