diff --git a/Libraries/LibCore/CMakeLists.txt b/Libraries/LibCore/CMakeLists.txt index d3136184d5b..6572f9b635c 100644 --- a/Libraries/LibCore/CMakeLists.txt +++ b/Libraries/LibCore/CMakeLists.txt @@ -48,7 +48,6 @@ set(SOURCES Resource.cpp ResourceImplementation.cpp ResourceImplementationFile.cpp - SessionManagement.cpp Socket.cpp SystemServerTakeover.cpp TCPServer.cpp diff --git a/Libraries/LibCore/LocalServer.cpp b/Libraries/LibCore/LocalServer.cpp index c37fac95503..9efc53dee84 100644 --- a/Libraries/LibCore/LocalServer.cpp +++ b/Libraries/LibCore/LocalServer.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -33,20 +32,6 @@ LocalServer::~LocalServer() ::close(m_fd); } -ErrorOr LocalServer::take_over_from_system_server(ByteString const& socket_path) -{ - if (m_listening) - return Error::from_string_literal("Core::LocalServer: Can't perform socket takeover when already listening"); - - auto const parsed_path = TRY(Core::SessionManagement::parse_path_with_sid(socket_path)); - auto socket = TRY(take_over_socket_from_system_server(parsed_path)); - m_fd = TRY(socket->release_fd()); - - m_listening = true; - setup_notifier(); - return {}; -} - ErrorOr LocalServer::take_over_fd(int socket_fd) { if (m_listening) diff --git a/Libraries/LibCore/LocalServer.h b/Libraries/LibCore/LocalServer.h index 150933ff8a4..0a847d25ee7 100644 --- a/Libraries/LibCore/LocalServer.h +++ b/Libraries/LibCore/LocalServer.h @@ -16,7 +16,6 @@ class LocalServer : public EventReceiver { public: virtual ~LocalServer() override; - ErrorOr take_over_from_system_server(ByteString const& path = ByteString()); ErrorOr take_over_fd(int socket_fd); bool is_listening() const { return m_listening; } bool listen(ByteString const& address); diff --git a/Libraries/LibCore/SessionManagement.cpp b/Libraries/LibCore/SessionManagement.cpp deleted file mode 100644 index e33900ab5de..00000000000 --- a/Libraries/LibCore/SessionManagement.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2022, Peter Elliott - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include -#include -#include - -namespace Core::SessionManagement { - -ErrorOr root_session_id([[maybe_unused]] Optional force_sid) -{ - return 0; -} - -ErrorOr logout(Optional force_sid) -{ - pid_t sid = TRY(root_session_id(force_sid)); - TRY(System::kill(-sid, SIGTERM)); - return {}; -} - -ErrorOr parse_path_with_sid(StringView general_path, Optional force_sid) -{ - if (general_path.contains("%sid"sv)) { - pid_t sid = TRY(root_session_id(force_sid)); - return general_path.replace("%sid"sv, ByteString::number(sid), ReplaceMode::All); - } - return ByteString(general_path); -} - -ErrorOr create_session_temporary_directory_if_needed(uid_t uid, gid_t gid, Optional force_sid) -{ - pid_t sid = TRY(root_session_id(force_sid)); - auto const temporary_directory = ByteString::formatted("/tmp/session/{}", sid); - auto directory = TRY(Core::Directory::create(temporary_directory, Core::Directory::CreateDirectories::Yes)); - TRY(directory.chown(uid, gid)); - return {}; -} - -} diff --git a/Libraries/LibCore/SessionManagement.h b/Libraries/LibCore/SessionManagement.h deleted file mode 100644 index 339280a7bfb..00000000000 --- a/Libraries/LibCore/SessionManagement.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022, Peter Elliott - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include - -namespace Core::SessionManagement { - -ErrorOr root_session_id(Optional force_sid = {}); -ErrorOr logout(Optional force_sid = {}); - -ErrorOr parse_path_with_sid(StringView general_path, Optional force_sid = {}); -ErrorOr create_session_temporary_directory_if_needed(uid_t uid, gid_t gid, Optional force_sid = {}); - -} diff --git a/Libraries/LibCore/StandardPaths.cpp b/Libraries/LibCore/StandardPaths.cpp index 433194b0213..8680dfc1600 100644 --- a/Libraries/LibCore/StandardPaths.cpp +++ b/Libraries/LibCore/StandardPaths.cpp @@ -18,7 +18,6 @@ #include #if !defined(AK_OS_WINDOWS) -# include # include # include #endif @@ -202,10 +201,7 @@ ErrorOr StandardPaths::runtime_directory() StringBuilder builder; -#if defined(AK_OS_SERENITY) - auto sid = TRY(Core::SessionManagement::root_session_id()); - builder.appendff("/tmp/session/{}", sid); -#elif defined(AK_OS_MACOS) +#if defined(AK_OS_MACOS) builder.append(home_directory()); builder.append("/Library/Application Support"sv); #elif defined(AK_OS_HAIKU) diff --git a/Libraries/LibCore/System.cpp b/Libraries/LibCore/System.cpp index 9936246218a..de3aab10667 100644 --- a/Libraries/LibCore/System.cpp +++ b/Libraries/LibCore/System.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/Libraries/LibIPC/ConnectionToServer.h b/Libraries/LibIPC/ConnectionToServer.h index 2a55528e304..9dd4497ae95 100644 --- a/Libraries/LibIPC/ConnectionToServer.h +++ b/Libraries/LibIPC/ConnectionToServer.h @@ -6,7 +6,6 @@ #pragma once -#include #include namespace IPC { diff --git a/Libraries/LibIPC/MultiServer.h b/Libraries/LibIPC/MultiServer.h index b40f8f138f9..c3a5b93d67b 100644 --- a/Libraries/LibIPC/MultiServer.h +++ b/Libraries/LibIPC/MultiServer.h @@ -16,13 +16,6 @@ namespace IPC { template class MultiServer { public: - static ErrorOr> try_create(Optional socket_path = {}) - { - auto server = TRY(Core::LocalServer::try_create()); - TRY(server->take_over_from_system_server(socket_path.value_or({}))); - return adopt_nonnull_own_or_enomem(new (nothrow) MultiServer(move(server))); - } - static ErrorOr> try_create(NonnullRefPtr server) { return adopt_nonnull_own_or_enomem(new (nothrow) MultiServer(move(server))); diff --git a/Meta/gn/secondary/Userland/Libraries/LibCore/BUILD.gn b/Meta/gn/secondary/Userland/Libraries/LibCore/BUILD.gn index 4a1e4cd3d73..ce9cab17b77 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibCore/BUILD.gn +++ b/Meta/gn/secondary/Userland/Libraries/LibCore/BUILD.gn @@ -74,8 +74,6 @@ source_set("sources") { "Resource.h", "ResourceImplementation.cpp", "ResourceImplementationFile.cpp", - "SessionManagement.cpp", - "SessionManagement.h", "SharedCircularQueue.h", "Socket.cpp", "Socket.h",