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

Kernel: Let the user read/write more than one page from/to dev files

Previously reads and writes to /dev/zero, /dev/full, /dev/null and
/dev/random were limited to 4096 bytes.

This removes that restriction so that users can enjoy more zero bytes
in their buffers.
This commit is contained in:
Gunnar Beutner 2021-05-27 09:13:49 +02:00 committed by Andreas Kling
parent a272c04c8a
commit 1ce32ef675
4 changed files with 7 additions and 9 deletions

View file

@ -26,15 +26,14 @@ bool ZeroDevice::can_read(const FileDescription&, size_t) const
KResultOr<size_t> ZeroDevice::read(FileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
{
ssize_t count = min(static_cast<size_t>(PAGE_SIZE), size);
if (!buffer.memset(0, count))
if (!buffer.memset(0, size))
return EFAULT;
return count;
return size;
}
KResultOr<size_t> ZeroDevice::write(FileDescription&, u64, const UserOrKernelBuffer&, size_t size)
{
return min(static_cast<size_t>(PAGE_SIZE), size);
return size;
}
}