1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:38:11 +00:00

Kernel: Make sys$perf_register_string() generate the string ID's

Making userspace provide a global string ID was silly, and made the API
extremely difficult to use correctly in a global profiling context.

Instead, simply make the kernel do the string ID allocation for us.
This also allows us to convert the string storage to a Vector in the
kernel (and an array in the JSON profile data.)
This commit is contained in:
Andreas Kling 2021-08-11 20:41:29 +02:00
parent 56e84a63ca
commit 1e90a3a542
8 changed files with 24 additions and 24 deletions

View file

@ -21,7 +21,7 @@ KResultOr<FlatPtr> Process::sys$perf_event(int type, FlatPtr arg1, FlatPtr arg2)
return events_buffer->append(type, arg1, arg2, nullptr);
}
KResultOr<FlatPtr> Process::sys$perf_register_string(FlatPtr string_id, Userspace<char const*> user_string, size_t user_string_length)
KResultOr<FlatPtr> Process::sys$perf_register_string(Userspace<char const*> user_string, size_t user_string_length)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
auto* events_buffer = current_perf_events_buffer();
@ -32,7 +32,7 @@ KResultOr<FlatPtr> Process::sys$perf_register_string(FlatPtr string_id, Userspac
if (string_or_error.is_error())
return string_or_error.error();
return events_buffer->register_string(string_id, string_or_error.release_value());
return events_buffer->register_string(string_or_error.release_value());
}
}