From 76c67b7ae958897c7485247306dc24d3c7335e66 Mon Sep 17 00:00:00 2001 From: Peter Elliott Date: Sun, 2 Oct 2022 18:17:24 -0600 Subject: LibCore: Make usernames optional in ProcessStatisticsReader --- Userland/Libraries/LibCore/ProcessStatisticsReader.cpp | 10 ++++++---- Userland/Libraries/LibCore/ProcessStatisticsReader.h | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'Userland/Libraries') diff --git a/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp b/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp index 979c1bc3f9..ccf136e7c5 100644 --- a/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp +++ b/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp @@ -16,7 +16,7 @@ namespace Core { HashMap ProcessStatisticsReader::s_usernames; -Optional ProcessStatisticsReader::get_all(RefPtr& proc_all_file) +Optional ProcessStatisticsReader::get_all(RefPtr& proc_all_file, bool include_usernames) { if (proc_all_file) { if (!proc_all_file->seek(0, Core::SeekMode::SetPosition)) { @@ -93,7 +93,9 @@ Optional ProcessStatisticsReader::get_all(RefPtr ProcessStatisticsReader::get_all(RefPtr ProcessStatisticsReader::get_all() +Optional ProcessStatisticsReader::get_all(bool include_usernames) { RefPtr proc_all_file; - return get_all(proc_all_file); + return get_all(proc_all_file, include_usernames); } String ProcessStatisticsReader::username_from_uid(uid_t uid) diff --git a/Userland/Libraries/LibCore/ProcessStatisticsReader.h b/Userland/Libraries/LibCore/ProcessStatisticsReader.h index 19d541a948..7edbdea024 100644 --- a/Userland/Libraries/LibCore/ProcessStatisticsReader.h +++ b/Userland/Libraries/LibCore/ProcessStatisticsReader.h @@ -72,8 +72,8 @@ struct AllProcessesStatistics { class ProcessStatisticsReader { public: - static Optional get_all(RefPtr&); - static Optional get_all(); + static Optional get_all(RefPtr&, bool include_usernames = true); + static Optional get_all(bool include_usernames = true); private: static String username_from_uid(uid_t); -- cgit v1.2.3