diff options
Diffstat (limited to 'Userland')
22 files changed, 78 insertions, 97 deletions
diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp index 90613a0be0..97c1fb2ee6 100644 --- a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp +++ b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp @@ -69,8 +69,8 @@ FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation VERIFY_NOT_REACHED(); } - m_notifier = Core::Notifier::construct(helper_pipe_fd, Core::Notifier::Read); - m_notifier->on_ready_to_read = [this] { + m_notifier = Core::Notifier::construct(helper_pipe_fd, Core::Notifier::Type::Read); + m_notifier->on_activation = [this] { auto line_buffer_or_error = ByteBuffer::create_zeroed(1 * KiB); if (line_buffer_or_error.is_error()) { did_error("Failed to allocate ByteBuffer for reading data."sv); @@ -211,7 +211,7 @@ void FileOperationProgressWidget::close_pipe() m_helper_pipe = nullptr; if (m_notifier) { m_notifier->set_enabled(false); - m_notifier->on_ready_to_read = nullptr; + m_notifier->on_activation = nullptr; } m_notifier = nullptr; } diff --git a/Userland/Libraries/LibChess/UCIEndpoint.cpp b/Userland/Libraries/LibChess/UCIEndpoint.cpp index b2bbd7d692..3ab72461a2 100644 --- a/Userland/Libraries/LibChess/UCIEndpoint.cpp +++ b/Userland/Libraries/LibChess/UCIEndpoint.cpp @@ -15,7 +15,7 @@ namespace Chess::UCI { Endpoint::Endpoint(NonnullRefPtr<Core::IODevice> in, NonnullRefPtr<Core::IODevice> out) : m_in(in) , m_out(out) - , m_in_notifier(Core::Notifier::construct(in->fd(), Core::Notifier::Read)) + , m_in_notifier(Core::Notifier::construct(in->fd(), Core::Notifier::Type::Read)) { set_in_notifier(); } @@ -70,8 +70,8 @@ void Endpoint::custom_event(Core::CustomEvent& custom_event) void Endpoint::set_in_notifier() { - m_in_notifier = Core::Notifier::construct(m_in->fd(), Core::Notifier::Read); - m_in_notifier->on_ready_to_read = [this] { + m_in_notifier = Core::Notifier::construct(m_in->fd(), Core::Notifier::Type::Read); + m_in_notifier->on_activation = [this] { if (!m_in->can_read_line()) { Core::EventLoop::current().post_event(*this, make<Core::CustomEvent>(EndpointEventType::UnexpectedEof)); m_in_notifier->set_enabled(false); diff --git a/Userland/Libraries/LibCore/Event.h b/Userland/Libraries/LibCore/Event.h index f3da4419e4..a539ee5943 100644 --- a/Userland/Libraries/LibCore/Event.h +++ b/Userland/Libraries/LibCore/Event.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> + * Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org> * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause @@ -21,8 +21,7 @@ public: Invalid = 0, Quit, Timer, - NotifierRead, - NotifierWrite, + NotifierActivation, DeferredInvoke, ChildAdded, ChildRemoved, @@ -79,29 +78,14 @@ private: int m_timer_id; }; -class NotifierReadEvent final : public Event { +class NotifierActivationEvent final : public Event { public: - explicit NotifierReadEvent(int fd) - : Event(Event::NotifierRead) + explicit NotifierActivationEvent(int fd) + : Event(Event::NotifierActivation) , m_fd(fd) { } - ~NotifierReadEvent() = default; - - int fd() const { return m_fd; } - -private: - int m_fd; -}; - -class NotifierWriteEvent final : public Event { -public: - explicit NotifierWriteEvent(int fd) - : Event(Event::NotifierWrite) - , m_fd(fd) - { - } - ~NotifierWriteEvent() = default; + ~NotifierActivationEvent() = default; int fd() const { return m_fd; } diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp index 979e551047..c8f48c6ebf 100644 --- a/Userland/Libraries/LibCore/EventLoop.cpp +++ b/Userland/Libraries/LibCore/EventLoop.cpp @@ -651,11 +651,11 @@ retry: max_fd = max(max_fd, max_fd_added); for (auto& notifier : *s_notifiers) { - if (notifier->event_mask() & Notifier::Read) + if (notifier->type() == Notifier::Type::Read) add_fd_to_set(notifier->fd(), rfds); - if (notifier->event_mask() & Notifier::Write) + if (notifier->type() == Notifier::Type::Write) add_fd_to_set(notifier->fd(), wfds); - if (notifier->event_mask() & Notifier::Exceptional) + if (notifier->type() == Notifier::Type::Exceptional) VERIFY_NOT_REACHED(); } @@ -757,13 +757,11 @@ try_select_again: // Handle file system notifiers by making them normal events. for (auto& notifier : *s_notifiers) { - if (FD_ISSET(notifier->fd(), &rfds)) { - if (notifier->event_mask() & Notifier::Event::Read) - post_event(*notifier, make<NotifierReadEvent>(notifier->fd())); + if (notifier->type() == Notifier::Type::Read && FD_ISSET(notifier->fd(), &rfds)) { + post_event(*notifier, make<NotifierActivationEvent>(notifier->fd())); } - if (FD_ISSET(notifier->fd(), &wfds)) { - if (notifier->event_mask() & Notifier::Event::Write) - post_event(*notifier, make<NotifierWriteEvent>(notifier->fd())); + if (notifier->type() == Notifier::Type::Write && FD_ISSET(notifier->fd(), &wfds)) { + post_event(*notifier, make<NotifierActivationEvent>(notifier->fd())); } } } diff --git a/Userland/Libraries/LibCore/FileWatcherLinux.cpp b/Userland/Libraries/LibCore/FileWatcherLinux.cpp index 963e809e73..4c0ccdc969 100644 --- a/Userland/Libraries/LibCore/FileWatcherLinux.cpp +++ b/Userland/Libraries/LibCore/FileWatcherLinux.cpp @@ -97,7 +97,7 @@ ErrorOr<NonnullRefPtr<FileWatcher>> FileWatcher::create(FileWatcherFlags flags) if (watcher_fd < 0) return Error::from_errno(errno); - auto notifier = TRY(Notifier::try_create(watcher_fd, Notifier::Event::Read)); + auto notifier = TRY(Notifier::try_create(watcher_fd, Notifier::Type::Read)); return adopt_nonnull_ref_or_enomem(new (nothrow) FileWatcher(watcher_fd, move(notifier))); } @@ -105,7 +105,7 @@ FileWatcher::FileWatcher(int watcher_fd, NonnullRefPtr<Notifier> notifier) : FileWatcherBase(watcher_fd) , m_notifier(move(notifier)) { - m_notifier->on_ready_to_read = [this] { + m_notifier->on_activation = [this] { auto maybe_event = get_event_from_fd(m_notifier->fd(), m_wd_to_path); if (maybe_event.has_value()) { auto event = maybe_event.value(); diff --git a/Userland/Libraries/LibCore/FileWatcherMacOS.mm b/Userland/Libraries/LibCore/FileWatcherMacOS.mm index 760fe6dc51..c546698273 100644 --- a/Userland/Libraries/LibCore/FileWatcherMacOS.mm +++ b/Userland/Libraries/LibCore/FileWatcherMacOS.mm @@ -59,7 +59,7 @@ public: // NOTE: This isn't actually used on macOS, but is needed for FileWatcherBase. // Creating it with an FD of -1 will effectively disable the notifier. - auto notifier = TRY(Notifier::try_create(-1, Notifier::Event::None)); + auto notifier = TRY(Notifier::try_create(-1, Notifier::Type::None)); return adopt_nonnull_ref_or_enomem(new (nothrow) FileWatcherMacOS(move(context), dispatch_queue, move(notifier))); } diff --git a/Userland/Libraries/LibCore/FileWatcherSerenity.cpp b/Userland/Libraries/LibCore/FileWatcherSerenity.cpp index fbf3344729..946826981e 100644 --- a/Userland/Libraries/LibCore/FileWatcherSerenity.cpp +++ b/Userland/Libraries/LibCore/FileWatcherSerenity.cpp @@ -188,7 +188,7 @@ ErrorOr<NonnullRefPtr<FileWatcher>> FileWatcher::create(FileWatcherFlags flags) if (watcher_fd < 0) return Error::from_errno(errno); - auto notifier = Notifier::construct(watcher_fd, Notifier::Event::Read); + auto notifier = Notifier::construct(watcher_fd, Notifier::Type::Read); return adopt_ref(*new FileWatcher(watcher_fd, move(notifier))); } @@ -196,7 +196,7 @@ FileWatcher::FileWatcher(int watcher_fd, NonnullRefPtr<Notifier> notifier) : FileWatcherBase(watcher_fd) , m_notifier(move(notifier)) { - m_notifier->on_ready_to_read = [this] { + m_notifier->on_activation = [this] { auto maybe_event = get_event_from_fd(m_notifier->fd(), m_wd_to_path); if (maybe_event.has_value()) { auto event = maybe_event.value(); @@ -214,7 +214,7 @@ FileWatcher::FileWatcher(int watcher_fd, NonnullRefPtr<Notifier> notifier) FileWatcher::~FileWatcher() { - m_notifier->on_ready_to_read = nullptr; + m_notifier->on_activation = nullptr; close(m_notifier->fd()); dbgln_if(FILE_WATCHER_DEBUG, "Stopped watcher at fd {}", m_notifier->fd()); } diff --git a/Userland/Libraries/LibCore/LocalServer.cpp b/Userland/Libraries/LibCore/LocalServer.cpp index 88a614fc8b..49f78c37fa 100644 --- a/Userland/Libraries/LibCore/LocalServer.cpp +++ b/Userland/Libraries/LibCore/LocalServer.cpp @@ -49,8 +49,8 @@ ErrorOr<void> LocalServer::take_over_from_system_server(DeprecatedString const& void LocalServer::setup_notifier() { - m_notifier = Notifier::construct(m_fd, Notifier::Event::Read, this); - m_notifier->on_ready_to_read = [this] { + m_notifier = Notifier::construct(m_fd, Notifier::Type::Read, this); + m_notifier->on_activation = [this] { if (on_accept) { auto maybe_client_socket = accept(); if (maybe_client_socket.is_error()) { diff --git a/Userland/Libraries/LibCore/Notifier.cpp b/Userland/Libraries/LibCore/Notifier.cpp index 17d55cfa7b..04e620f1be 100644 --- a/Userland/Libraries/LibCore/Notifier.cpp +++ b/Userland/Libraries/LibCore/Notifier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> + * Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -10,10 +10,10 @@ namespace Core { -Notifier::Notifier(int fd, unsigned event_mask, Object* parent) +Notifier::Notifier(int fd, Type type, Object* parent) : Object(parent) , m_fd(fd) - , m_event_mask(event_mask) + , m_type(type) { set_enabled(true); } @@ -43,13 +43,12 @@ void Notifier::close() void Notifier::event(Core::Event& event) { - if (event.type() == Core::Event::NotifierRead && on_ready_to_read) { - on_ready_to_read(); - } else if (event.type() == Core::Event::NotifierWrite && on_ready_to_write) { - on_ready_to_write(); - } else { - Object::event(event); + if (event.type() == Core::Event::NotifierActivation) { + if (on_activation) + on_activation(); + return; } + Object::event(event); } } diff --git a/Userland/Libraries/LibCore/Notifier.h b/Userland/Libraries/LibCore/Notifier.h index ff7d0eb8c8..1815ad0b2c 100644 --- a/Userland/Libraries/LibCore/Notifier.h +++ b/Userland/Libraries/LibCore/Notifier.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> + * Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -11,36 +11,36 @@ namespace Core { -class Notifier : public Object { - C_OBJECT(Notifier) +class Notifier final : public Object { + C_OBJECT(Notifier); + public: - enum Event { - None = 0, - Read = 1, - Write = 2, - Exceptional = 4, + enum class Type { + None, + Read, + Write, + Exceptional, }; virtual ~Notifier() override; void set_enabled(bool); - Function<void()> on_ready_to_read; - Function<void()> on_ready_to_write; + Function<void()> on_activation; void close(); int fd() const { return m_fd; } - unsigned event_mask() const { return m_event_mask; } - void set_event_mask(unsigned event_mask) { m_event_mask = event_mask; } + Type type() const { return m_type; } + void set_type(Type type) { m_type = type; } void event(Core::Event&) override; private: - Notifier(int fd, unsigned event_mask, Object* parent = nullptr); + Notifier(int fd, Type type, Object* parent = nullptr); int m_fd { -1 }; - unsigned m_event_mask { 0 }; + Type m_type { Type::None }; }; } diff --git a/Userland/Libraries/LibCore/Socket.cpp b/Userland/Libraries/LibCore/Socket.cpp index dfc400322f..639837ae0b 100644 --- a/Userland/Libraries/LibCore/Socket.cpp +++ b/Userland/Libraries/LibCore/Socket.cpp @@ -186,7 +186,7 @@ ErrorOr<void> PosixSocketHelper::set_receive_timeout(Time timeout) void PosixSocketHelper::setup_notifier() { if (!m_notifier) - m_notifier = Core::Notifier::construct(m_fd, Core::Notifier::Read); + m_notifier = Core::Notifier::construct(m_fd, Core::Notifier::Type::Read); } ErrorOr<NonnullOwnPtr<TCPSocket>> TCPSocket::connect(DeprecatedString const& host, u16 port) diff --git a/Userland/Libraries/LibCore/Socket.h b/Userland/Libraries/LibCore/Socket.h index 0906b02116..f005fa2074 100644 --- a/Userland/Libraries/LibCore/Socket.h +++ b/Userland/Libraries/LibCore/Socket.h @@ -204,7 +204,7 @@ private: VERIFY(is_open()); m_helper.setup_notifier(); - m_helper.notifier()->on_ready_to_read = [this] { + m_helper.notifier()->on_activation = [this] { if (on_ready_to_read) on_ready_to_read(); }; @@ -278,7 +278,7 @@ private: VERIFY(is_open()); m_helper.setup_notifier(); - m_helper.notifier()->on_ready_to_read = [this] { + m_helper.notifier()->on_activation = [this] { if (on_ready_to_read) on_ready_to_read(); }; @@ -352,7 +352,7 @@ private: VERIFY(is_open()); m_helper.setup_notifier(); - m_helper.notifier()->on_ready_to_read = [this] { + m_helper.notifier()->on_activation = [this] { if (on_ready_to_read) on_ready_to_read(); }; diff --git a/Userland/Libraries/LibCore/TCPServer.cpp b/Userland/Libraries/LibCore/TCPServer.cpp index d5ab99f241..0a5a42963e 100644 --- a/Userland/Libraries/LibCore/TCPServer.cpp +++ b/Userland/Libraries/LibCore/TCPServer.cpp @@ -57,8 +57,8 @@ ErrorOr<void> TCPServer::listen(IPv4Address const& address, u16 port, AllowAddre TRY(Core::System::listen(m_fd, 5)); m_listening = true; - m_notifier = Notifier::construct(m_fd, Notifier::Event::Read, this); - m_notifier->on_ready_to_read = [this] { + m_notifier = Notifier::construct(m_fd, Notifier::Type::Read, this); + m_notifier->on_activation = [this] { if (on_ready_to_accept) on_ready_to_accept(); }; diff --git a/Userland/Libraries/LibCore/UDPServer.cpp b/Userland/Libraries/LibCore/UDPServer.cpp index da46081c19..70249b623a 100644 --- a/Userland/Libraries/LibCore/UDPServer.cpp +++ b/Userland/Libraries/LibCore/UDPServer.cpp @@ -55,8 +55,8 @@ bool UDPServer::bind(IPv4Address const& address, u16 port) m_bound = true; - m_notifier = Notifier::construct(m_fd, Notifier::Event::Read, this); - m_notifier->on_ready_to_read = [this] { + m_notifier = Notifier::construct(m_fd, Notifier::Type::Read, this); + m_notifier->on_activation = [this] { if (on_ready_to_receive) on_ready_to_receive(); }; diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp index 0569a27bd7..573467d148 100644 --- a/Userland/Libraries/LibLine/Editor.cpp +++ b/Userland/Libraries/LibLine/Editor.cpp @@ -747,9 +747,9 @@ auto Editor::get_line(DeprecatedString const& prompt) -> Result<DeprecatedString Core::EventLoop loop; - m_notifier = Core::Notifier::construct(STDIN_FILENO, Core::Notifier::Read); + m_notifier = Core::Notifier::construct(STDIN_FILENO, Core::Notifier::Type::Read); - m_notifier->on_ready_to_read = [&] { + m_notifier->on_activation = [&] { if (try_update_once().is_error()) loop.quit(Exit); }; diff --git a/Userland/Libraries/LibProtocol/Request.cpp b/Userland/Libraries/LibProtocol/Request.cpp index 741ee08eed..ce31c9a3e2 100644 --- a/Userland/Libraries/LibProtocol/Request.cpp +++ b/Userland/Libraries/LibProtocol/Request.cpp @@ -25,7 +25,7 @@ void Request::stream_into(Stream& stream) VERIFY(!m_internal_stream_data); m_internal_stream_data = make<InternalStreamData>(MUST(Core::File::adopt_fd(fd(), Core::File::OpenMode::Read))); - m_internal_stream_data->read_notifier = Core::Notifier::construct(fd(), Core::Notifier::Read); + m_internal_stream_data->read_notifier = Core::Notifier::construct(fd(), Core::Notifier::Type::Read); auto user_on_finish = move(on_finish); on_finish = [this](auto success, auto total_size) { @@ -41,7 +41,7 @@ void Request::stream_into(Stream& stream) user_on_finish(m_internal_stream_data->success, m_internal_stream_data->total_size); } }; - m_internal_stream_data->read_notifier->on_ready_to_read = [this, &stream] { + m_internal_stream_data->read_notifier->on_activation = [this, &stream] { constexpr size_t buffer_size = 256 * KiB; static char buf[buffer_size]; do { diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index 23ec4d155b..7de7f08cef 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -47,8 +47,8 @@ void TerminalWidget::set_pty_master_fd(int fd) m_notifier = nullptr; return; } - m_notifier = Core::Notifier::construct(m_ptm_fd, Core::Notifier::Read); - m_notifier->on_ready_to_read = [this] { + m_notifier = Core::Notifier::construct(m_ptm_fd, Core::Notifier::Type::Read); + m_notifier->on_activation = [this] { u8 buffer[BUFSIZ]; ssize_t nread = read(m_ptm_fd, buffer, sizeof(buffer)); if (nread < 0) { diff --git a/Userland/Services/SpiceAgent/SpiceAgent.cpp b/Userland/Services/SpiceAgent/SpiceAgent.cpp index 83292d8bc3..d4081f4fec 100644 --- a/Userland/Services/SpiceAgent/SpiceAgent.cpp +++ b/Userland/Services/SpiceAgent/SpiceAgent.cpp @@ -19,8 +19,8 @@ SpiceAgent::SpiceAgent(int fd, ConnectionToClipboardServer& connection) : m_fd(fd) , m_clipboard_connection(connection) { - m_notifier = Core::Notifier::construct(fd, Core::Notifier::Read); - m_notifier->on_ready_to_read = [this] { + m_notifier = Core::Notifier::construct(fd, Core::Notifier::Type::Read); + m_notifier->on_activation = [this] { on_message_received(); }; m_clipboard_connection.on_data_changed = [this] { diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp index c2fb68a0a4..9928e44207 100644 --- a/Userland/Services/SystemServer/Service.cpp +++ b/Userland/Services/SystemServer/Service.cpp @@ -82,8 +82,8 @@ void Service::setup_notifier() VERIFY(m_sockets.size() == 1); VERIFY(!m_socket_notifier); - m_socket_notifier = Core::Notifier::construct(m_sockets[0].fd, Core::Notifier::Event::Read, this); - m_socket_notifier->on_ready_to_read = [this] { + m_socket_notifier = Core::Notifier::construct(m_sockets[0].fd, Core::Notifier::Type::Read, this); + m_socket_notifier->on_activation = [this] { if (auto result = handle_socket_connection(); result.is_error()) dbgln("{}", result.release_error()); }; diff --git a/Userland/Services/TelnetServer/Client.cpp b/Userland/Services/TelnetServer/Client.cpp index 7d1efc740d..efd83fe60d 100644 --- a/Userland/Services/TelnetServer/Client.cpp +++ b/Userland/Services/TelnetServer/Client.cpp @@ -21,7 +21,7 @@ Client::Client(int id, NonnullOwnPtr<Core::TCPSocket> socket, int ptm_fd) : m_id(id) , m_socket(move(socket)) , m_ptm_fd(ptm_fd) - , m_ptm_notifier(Core::Notifier::construct(ptm_fd, Core::Notifier::Read)) + , m_ptm_notifier(Core::Notifier::construct(ptm_fd, Core::Notifier::Type::Read)) { m_socket->on_ready_to_read = [this] { auto result = drain_socket(); @@ -31,7 +31,7 @@ Client::Client(int id, NonnullOwnPtr<Core::TCPSocket> socket, int ptm_fd) } }; - m_ptm_notifier->on_ready_to_read = [this] { + m_ptm_notifier->on_activation = [this] { auto result = drain_pty(); if (result.is_error()) { dbgln("Failed to drain the PTY: {}", result.error()); diff --git a/Userland/Services/WindowServer/EventLoop.cpp b/Userland/Services/WindowServer/EventLoop.cpp index 04dfe2ec41..0068a25583 100644 --- a/Userland/Services/WindowServer/EventLoop.cpp +++ b/Userland/Services/WindowServer/EventLoop.cpp @@ -27,15 +27,15 @@ EventLoop::EventLoop() m_wm_server = MUST(IPC::MultiServer<WMConnectionFromClient>::try_create("/tmp/portal/wm")); if (m_keyboard_fd >= 0) { - m_keyboard_notifier = Core::Notifier::construct(m_keyboard_fd, Core::Notifier::Read); - m_keyboard_notifier->on_ready_to_read = [this] { drain_keyboard(); }; + m_keyboard_notifier = Core::Notifier::construct(m_keyboard_fd, Core::Notifier::Type::Read); + m_keyboard_notifier->on_activation = [this] { drain_keyboard(); }; } else { dbgln("Couldn't open /dev/input/keyboard/0"); } if (m_mouse_fd >= 0) { - m_mouse_notifier = Core::Notifier::construct(m_mouse_fd, Core::Notifier::Read); - m_mouse_notifier->on_ready_to_read = [this] { drain_mouse(); }; + m_mouse_notifier = Core::Notifier::construct(m_mouse_fd, Core::Notifier::Type::Read); + m_mouse_notifier->on_activation = [this] { drain_mouse(); }; } else { dbgln("Couldn't open /dev/input/mouse/0"); } diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp index cb90595472..45dd80f8e7 100644 --- a/Userland/Shell/AST.cpp +++ b/Userland/Shell/AST.cpp @@ -1742,7 +1742,7 @@ ErrorOr<void> Execute::for_each_entry(RefPtr<Shell> shell, Function<ErrorOr<Iter Core::EventLoop loop; - auto notifier = Core::Notifier::construct(pipefd[0], Core::Notifier::Read); + auto notifier = Core::Notifier::construct(pipefd[0], Core::Notifier::Type::Read); AllocatingMemoryStream stream; enum CheckResult { @@ -1788,18 +1788,18 @@ ErrorOr<void> Execute::for_each_entry(RefPtr<Shell> shell, Function<ErrorOr<Iter return NothingLeft; }; - notifier->on_ready_to_read = [&]() -> void { + notifier->on_activation = [&]() -> void { constexpr static auto buffer_size = 16; u8 buffer[buffer_size]; size_t remaining_size = buffer_size; for (;;) { - notifier->set_event_mask(Core::Notifier::None); + notifier->set_type(Core::Notifier::Type::None); bool should_enable_notifier = false; ScopeGuard notifier_enabler { [&] { if (should_enable_notifier) - notifier->set_event_mask(Core::Notifier::Read); + notifier->set_type(Core::Notifier::Type::Read); } }; if (check_and_call().release_value_but_fixme_should_propagate_errors() == Break) { @@ -1841,7 +1841,7 @@ ErrorOr<void> Execute::for_each_entry(RefPtr<Shell> shell, Function<ErrorOr<Iter auto exit_reason = loop.exec(); - notifier->on_ready_to_read = nullptr; + notifier->on_activation = nullptr; if (close(pipefd[0]) < 0) { dbgln("close() failed: {}", strerror(errno)); |