diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-10-14 13:16:09 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-10-14 13:16:09 +0200 |
commit | 9f9b4a23823a851d632a0b2e757f1232b5de5620 (patch) | |
tree | 8e17a652ebf0710822b5cee5d52e0cceb3064cd4 /VirtualFileSystem/FullDevice.cpp | |
parent | fc1facf5c09a92cf49ce2b2db729cac51f6e75e2 (diff) | |
download | serenity-9f9b4a23823a851d632a0b2e757f1232b5de5620.zip |
Add a simple /dev/full.
Diffstat (limited to 'VirtualFileSystem/FullDevice.cpp')
-rw-r--r-- | VirtualFileSystem/FullDevice.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/VirtualFileSystem/FullDevice.cpp b/VirtualFileSystem/FullDevice.cpp new file mode 100644 index 0000000000..2ef60e6299 --- /dev/null +++ b/VirtualFileSystem/FullDevice.cpp @@ -0,0 +1,30 @@ +#include "FullDevice.h" +#include "Limits.h" +#include "sys-errno.h" +#include <AK/StdLib.h> +#include <cstring> +#include <cstdio> + +FullDevice::FullDevice() +{ +} + +FullDevice::~FullDevice() +{ +} + +ssize_t FullDevice::read(byte* buffer, size_t bufferSize) +{ + printf("read from full device\n"); + size_t count = min(GoodBufferSize, bufferSize); + memset(buffer, 0, count); + return count; +} + +ssize_t FullDevice::write(const byte*, size_t bufferSize) +{ + if (bufferSize == 0) + return 0; + return -ENOSPC; +} + |