summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibCore/ProcessStatisticsReader.cpp10
-rw-r--r--Userland/Libraries/LibCore/ProcessStatisticsReader.h4
2 files changed, 8 insertions, 6 deletions
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<uid_t, String> ProcessStatisticsReader::s_usernames;
-Optional<AllProcessesStatistics> ProcessStatisticsReader::get_all(RefPtr<Core::File>& proc_all_file)
+Optional<AllProcessesStatistics> ProcessStatisticsReader::get_all(RefPtr<Core::File>& proc_all_file, bool include_usernames)
{
if (proc_all_file) {
if (!proc_all_file->seek(0, Core::SeekMode::SetPosition)) {
@@ -93,7 +93,9 @@ Optional<AllProcessesStatistics> ProcessStatisticsReader::get_all(RefPtr<Core::F
});
// and synthetic data last
- process.username = username_from_uid(process.uid);
+ if (include_usernames) {
+ process.username = username_from_uid(process.uid);
+ }
all_processes_statistics.processes.append(move(process));
});
@@ -102,10 +104,10 @@ Optional<AllProcessesStatistics> ProcessStatisticsReader::get_all(RefPtr<Core::F
return all_processes_statistics;
}
-Optional<AllProcessesStatistics> ProcessStatisticsReader::get_all()
+Optional<AllProcessesStatistics> ProcessStatisticsReader::get_all(bool include_usernames)
{
RefPtr<Core::File> 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<AllProcessesStatistics> get_all(RefPtr<Core::File>&);
- static Optional<AllProcessesStatistics> get_all();
+ static Optional<AllProcessesStatistics> get_all(RefPtr<Core::File>&, bool include_usernames = true);
+ static Optional<AllProcessesStatistics> get_all(bool include_usernames = true);
private:
static String username_from_uid(uid_t);