1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:47:44 +00:00

Kernel+LibC: Make get_dir_entries syscall retriable

The get_dir_entries syscall failed if the serialized form of all the
directory entries together was too large to fit in its temporary buffer.

Now the kernel uses a fixed size buffer, that is flushed to an output
buffer when it is full. If this flushing operation fails because there
is not enough space available, the syscall will return -EINVAL. That
error code is then used in userspace as a signal to allocate a larger
buffer and retry the syscall.
This commit is contained in:
Mart G 2021-05-11 18:35:36 +02:00 committed by Andreas Kling
parent c7b60164ed
commit b00cdf8ed8
3 changed files with 65 additions and 21 deletions

View file

@ -129,6 +129,7 @@ public:
size_t size() const { return m_offset; }
size_t remaining() const { return m_bytes.size() - m_offset; }
void reset() { m_offset = 0; }
private:
size_t m_offset { 0 };