mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:27:34 +00:00
AK+Kernel: Introduce StdLib function to copy FixedStringBuffer to user
This new Kernel StdLib function will be used to copy contents of a FixedStringBuffer with a null character to a user process. The first user of this new function is the prctl option of PR_GET_PROCESS_NAME which would copy a process name including a null character to a user provided buffer.
This commit is contained in:
parent
6cb88e224e
commit
72231b405a
3 changed files with 19 additions and 5 deletions
|
@ -95,8 +95,13 @@ public:
|
|||
return m_storage.span();
|
||||
}
|
||||
StringView representable_view() const { return StringView(m_storage.data(), m_stored_length); }
|
||||
Span<u8 const> span_view_ensuring_ending_null_char()
|
||||
{
|
||||
VERIFY(m_stored_length + 1 <= Size);
|
||||
m_storage[m_stored_length] = '\0';
|
||||
return Span<u8 const>(m_storage.data(), m_stored_length + 1);
|
||||
}
|
||||
|
||||
size_t fixed_length() const { return Size; }
|
||||
size_t stored_length() const { return m_stored_length; }
|
||||
|
||||
FixedStringBuffer()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue