mirror of
https://github.com/RGBCube/serenity
synced 2025-07-21 14:37:35 +00:00

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.
39 lines
1 KiB
C++
39 lines
1 KiB
C++
/*
|
|
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/Devices/ConsoleDevice.h>
|
|
#include <Kernel/Devices/DeviceManagement.h>
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Log.h>
|
|
#include <Kernel/Sections.h>
|
|
|
|
namespace Kernel {
|
|
|
|
UNMAP_AFTER_INIT SysFSKernelLog::SysFSKernelLog(SysFSDirectory const& parent_directory)
|
|
: SysFSGlobalInformation(parent_directory)
|
|
{
|
|
}
|
|
|
|
UNMAP_AFTER_INIT NonnullLockRefPtr<SysFSKernelLog> SysFSKernelLog::must_create(SysFSDirectory const& parent_directory)
|
|
{
|
|
return adopt_lock_ref_if_nonnull(new (nothrow) SysFSKernelLog(parent_directory)).release_nonnull();
|
|
}
|
|
|
|
mode_t SysFSKernelLog::permissions() const
|
|
{
|
|
return S_IRUSR;
|
|
}
|
|
|
|
ErrorOr<void> SysFSKernelLog::try_generate(KBufferBuilder& builder)
|
|
{
|
|
VERIFY(DeviceManagement::the().is_console_device_attached());
|
|
SpinlockLocker lock(g_console_lock);
|
|
for (char ch : DeviceManagement::the().console_device().logbuffer()) {
|
|
TRY(builder.append(ch));
|
|
}
|
|
return {};
|
|
}
|
|
|
|
}
|