mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 01:25:08 +00:00

Instead, allow userspace to decide on the coredump directory path. By default, SystemServer sets it to the /tmp/coredump directory, but users can now change this by writing a new path to the sysfs node at /sys/kernel/variables/coredump_directory, and also to read this node to check where coredumps are currently generated at.
36 lines
1.6 KiB
C++
36 lines
1.6 KiB
C++
/*
|
|
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <AK/Error.h>
|
|
#include <AK/Try.h>
|
|
#include <Kernel/FileSystem/SysFS/Component.h>
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/CapsLockRemap.h>
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/CoredumpDirectory.h>
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/Directory.h>
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/DumpKmallocStack.h>
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/UBSANDeadly.h>
|
|
|
|
namespace Kernel {
|
|
|
|
UNMAP_AFTER_INIT NonnullLockRefPtr<SysFSGlobalKernelVariablesDirectory> SysFSGlobalKernelVariablesDirectory::must_create(SysFSDirectory const& parent_directory)
|
|
{
|
|
auto global_variables_directory = adopt_lock_ref_if_nonnull(new (nothrow) SysFSGlobalKernelVariablesDirectory(parent_directory)).release_nonnull();
|
|
MUST(global_variables_directory->m_child_components.with([&](auto& list) -> ErrorOr<void> {
|
|
list.append(SysFSCapsLockRemap::must_create(*global_variables_directory));
|
|
list.append(SysFSDumpKmallocStacks::must_create(*global_variables_directory));
|
|
list.append(SysFSUBSANDeadly::must_create(*global_variables_directory));
|
|
list.append(SysFSCoredumpDirectory::must_create(*global_variables_directory));
|
|
return {};
|
|
}));
|
|
return global_variables_directory;
|
|
}
|
|
|
|
UNMAP_AFTER_INIT SysFSGlobalKernelVariablesDirectory::SysFSGlobalKernelVariablesDirectory(SysFSDirectory const& parent_directory)
|
|
: SysFSDirectory(parent_directory)
|
|
{
|
|
}
|
|
|
|
}
|