1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:58:12 +00:00

Kernel: Add try_copy_kstring_from_user()

This is a convenience function that works the same as our old
copy_string_from_user(), but this returns a KString (and can fail!)
This commit is contained in:
Andreas Kling 2021-05-28 09:29:16 +02:00
parent 279383a8f3
commit 856f20f91f
3 changed files with 43 additions and 0 deletions

View file

@ -814,6 +814,11 @@ inline static String copy_string_from_user(const Kernel::Syscall::StringArgument
return copy_string_from_user(string.characters, string.length);
}
inline static KResultOr<NonnullOwnPtr<KString>> try_copy_kstring_from_user(const Kernel::Syscall::StringArgument& string)
{
return try_copy_kstring_from_user(string.characters, string.length);
}
template<>
struct AK::Formatter<Kernel::Process> : AK::Formatter<String> {
void format(FormatBuilder& builder, const Kernel::Process& value)