mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 12:18:25 +00:00
To do this we also need to get rid of LockRefPtrs in the USB code as well. Most of the SysFS nodes are statically generated during boot and are not mutated afterwards. The same goes for general device code - once we generate the appropriate SysFS nodes, we almost never mutate the node pointers afterwards, making locking unnecessary.
37 lines
869 B
C++
37 lines
869 B
C++
/*
|
|
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Profile.h>
|
|
#include <Kernel/PerformanceEventBuffer.h>
|
|
#include <Kernel/Sections.h>
|
|
|
|
namespace Kernel {
|
|
|
|
UNMAP_AFTER_INIT SysFSProfile::SysFSProfile(SysFSDirectory const& parent_directory)
|
|
: SysFSGlobalInformation(parent_directory)
|
|
{
|
|
}
|
|
|
|
UNMAP_AFTER_INIT NonnullRefPtr<SysFSProfile> SysFSProfile::must_create(SysFSDirectory const& parent_directory)
|
|
{
|
|
return adopt_ref_if_nonnull(new (nothrow) SysFSProfile(parent_directory)).release_nonnull();
|
|
}
|
|
|
|
ErrorOr<void> SysFSProfile::try_generate(KBufferBuilder& builder)
|
|
{
|
|
if (!g_global_perf_events)
|
|
return ENOENT;
|
|
TRY(g_global_perf_events->to_json(builder));
|
|
return {};
|
|
}
|
|
|
|
mode_t SysFSProfile::permissions() const
|
|
{
|
|
return S_IRUSR;
|
|
}
|
|
|
|
}
|