File indexing completed on 2024-04-21 05:45:52
0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0002 // SPDX-FileCopyrightText: 2021-2022 Harald Sitter <sitter@kde.org> 0003 0004 #pragma once 0005 0006 #include <filesystem> 0007 #include <vector> 0008 0009 #include <QString> 0010 0011 struct Entry { 0012 uid_t uid = -1; 0013 pid_t pid = -1; 0014 qulonglong instances = 0; 0015 qulonglong watches = 0; 0016 QString cmdline; 0017 }; 0018 0019 struct INotifyCapacity { 0020 const qulonglong max_user_instances; 0021 const qulonglong max_user_watches; 0022 }; 0023 0024 [[nodiscard]] qulonglong procULongLong(const QString &path); 0025 [[nodiscard]] std::vector<Entry> collectEntries(const std::string_view &procPath = {"/proc/"}); 0026 [[nodiscard]] INotifyCapacity inotifyCapacity(const std::string_view &procPath = {"/proc/"}); 0027 [[nodiscard]] INotifyCapacity maximumINotifyCapacity(); 0028 [[nodiscard]] qulonglong instanceStepSize(); 0029 [[nodiscard]] qulonglong watchStepSize(); 0030 0031 [[nodiscard]] std::filesystem::path max_user_instances_path(const std::string_view &procPath = {"/proc/"}); 0032 [[nodiscard]] std::filesystem::path max_user_watches_path(const std::string_view &procPath = {"/proc/"});