mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
Kernel: Implement peek() function for DoubleBuffer
This allows us to "peek" into a DoubleBuffer without incrementing the m_read_buffer_index, which is needed to implement MSG_PEEK.
This commit is contained in:
parent
9bcdbe205b
commit
2d098c88dc
Notes:
sideshowbarker
2024-07-18 18:57:17 +09:00
Author: https://github.com/sw1tchbl4d3r 🔰
Commit: 2d098c88dc
Pull-request: https://github.com/SerenityOS/serenity/pull/6715
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/sin-ack
2 changed files with 25 additions and 2 deletions
|
@ -29,6 +29,12 @@ public:
|
|||
auto buffer = UserOrKernelBuffer::for_kernel_buffer(data);
|
||||
return read(buffer, size);
|
||||
}
|
||||
[[nodiscard]] ssize_t peek(UserOrKernelBuffer&, size_t);
|
||||
[[nodiscard]] ssize_t peek(u8* data, size_t size)
|
||||
{
|
||||
auto buffer = UserOrKernelBuffer::for_kernel_buffer(data);
|
||||
return peek(buffer, size);
|
||||
}
|
||||
|
||||
bool is_empty() const { return m_empty; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue