mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
LibCore: Allow caching and reusing the ProcFS file descriptors
Because ProcFS will refresh the data upon seek to 0, we can re-use the same file descriptor. This saves us from having to open it every time, but it also reduces the odds that we are unable to open a new file descriptor due to low memory conditions.
This commit is contained in:
parent
cf89180c35
commit
bc3c0fa936
2 changed files with 21 additions and 6 deletions
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace Core {
|
||||
|
@ -86,6 +87,7 @@ struct ProcessStatistics {
|
|||
|
||||
class ProcessStatisticsReader {
|
||||
public:
|
||||
static Optional<HashMap<pid_t, Core::ProcessStatistics>> get_all(RefPtr<Core::File>&);
|
||||
static Optional<HashMap<pid_t, Core::ProcessStatistics>> get_all();
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue