diff options
author | Liav A <liavalb@gmail.com> | 2022-11-26 14:42:35 +0200 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2022-12-03 05:56:59 -0700 |
commit | 0bb7c8f4c4757ed1f1abb77a46ba32e9cf72106d (patch) | |
tree | 08a3b6fe067b25f042f5bbeccd6460dc444c5211 /Kernel/Coredump.cpp | |
parent | 7dcf8f971b9caf7abe01691fcedce978844585e4 (diff) | |
download | serenity-0bb7c8f4c4757ed1f1abb77a46ba32e9cf72106d.zip |
Kernel+SystemServer: Don't hardcode coredump directory path
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.
Diffstat (limited to 'Kernel/Coredump.cpp')
-rw-r--r-- | Kernel/Coredump.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Kernel/Coredump.cpp b/Kernel/Coredump.cpp index 82c99329f1..4aa70c5230 100644 --- a/Kernel/Coredump.cpp +++ b/Kernel/Coredump.cpp @@ -9,6 +9,7 @@ #include <AK/ByteBuffer.h> #include <AK/JsonObjectSerializer.h> +#include <AK/Singleton.h> #include <Kernel/Coredump.h> #include <Kernel/FileSystem/Custody.h> #include <Kernel/FileSystem/OpenFileDescription.h> @@ -22,8 +23,15 @@ #define INCLUDE_USERSPACE_HEAP_MEMORY_IN_COREDUMPS 0 +static Singleton<SpinlockProtected<OwnPtr<KString>>> s_coredump_directory_path; + namespace Kernel { +SpinlockProtected<OwnPtr<KString>>& Coredump::directory_path() +{ + return s_coredump_directory_path; +} + bool Coredump::FlatRegionData::looks_like_userspace_heap_region() const { return name().starts_with("LibJS:"sv) || name().starts_with("malloc:"sv); |