Files
ladybird/Kernel/FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.h
Liav A a91589c09b Kernel: Introduce global variables and stats in /sys/kernel directory
The ProcFS is an utter mess currently, so let's start move things that
are not related to processes-info. To ensure it's done in a sane manner,
we start by duplicating all /proc/ global nodes to the /sys/kernel/
directory, then we will move Userland to use the new directory so the
old directory nodes can be removed from the /proc directory.
2022-10-25 15:33:34 -06:00

35 lines
969 B
C++

/*
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Error.h>
#include <AK/Try.h>
#include <AK/Types.h>
#include <Kernel/FileSystem/FileSystem.h>
#include <Kernel/FileSystem/OpenFileDescription.h>
#include <Kernel/FileSystem/SysFS/Component.h>
#include <Kernel/KBufferBuilder.h>
#include <Kernel/Library/LockRefPtr.h>
#include <Kernel/Locking/Mutex.h>
#include <Kernel/UserOrKernelBuffer.h>
namespace Kernel {
class SysFSGlobalInformation : public SysFSComponent {
public:
virtual ErrorOr<size_t> read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, OpenFileDescription* description) const override;
protected:
explicit SysFSGlobalInformation(SysFSDirectory const& parent_directory);
virtual ErrorOr<void> refresh_data(OpenFileDescription&) const override;
virtual ErrorOr<void> try_generate(KBufferBuilder&) = 0;
mutable Mutex m_refresh_lock;
};
}