diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-02 16:55:54 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-02 22:38:06 +0100 |
commit | b425c2602c6dd10b5509fcd8d81c765b9c76993a (patch) | |
tree | 2bf74d65414324093a011cd026daa72adf8df049 /Kernel/Process.h | |
parent | e7ef729db308d3372a129f4313a5c3e9fc0b36ae (diff) | |
download | serenity-b425c2602c6dd10b5509fcd8d81c765b9c76993a.zip |
Kernel: Better handling of allocation failure in profiling
If we can't allocate a PerformanceEventBuffer to store the profiling
events, we now fail sys$profiling_enable() and sys$perf_event()
with ENOMEM instead of carrying on with a broken buffer.
Diffstat (limited to 'Kernel/Process.h')
-rw-r--r-- | Kernel/Process.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Kernel/Process.h b/Kernel/Process.h index 0a64d40209..626072baa8 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -467,8 +467,6 @@ private: bool add_thread(Thread&); bool remove_thread(Thread&); - PerformanceEventBuffer& ensure_perf_events(); - Process(RefPtr<Thread>& first_thread, const String& name, uid_t, gid_t, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> cwd = nullptr, RefPtr<Custody> executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr); static ProcessID allocate_pid(); @@ -476,6 +474,7 @@ private: void kill_all_threads(); bool dump_core(); bool dump_perfcore(); + bool create_perf_events_buffer_if_needed(); KResult do_exec(NonnullRefPtr<FileDescription> main_program_description, Vector<String> arguments, Vector<String> environment, RefPtr<FileDescription> interpreter_description, Thread*& new_main_thread, u32& prev_flags, const Elf32_Ehdr& main_program_header); KResultOr<ssize_t> do_write(FileDescription&, const UserOrKernelBuffer&, size_t); |