summaryrefslogtreecommitdiff
path: root/VirtualFileSystem/FullDevice.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-10-14 13:16:09 +0200
committerAndreas Kling <awesomekling@gmail.com>2018-10-14 13:16:09 +0200
commit9f9b4a23823a851d632a0b2e757f1232b5de5620 (patch)
tree8e17a652ebf0710822b5cee5d52e0cceb3064cd4 /VirtualFileSystem/FullDevice.cpp
parentfc1facf5c09a92cf49ce2b2db729cac51f6e75e2 (diff)
downloadserenity-9f9b4a23823a851d632a0b2e757f1232b5de5620.zip
Add a simple /dev/full.
Diffstat (limited to 'VirtualFileSystem/FullDevice.cpp')
-rw-r--r--VirtualFileSystem/FullDevice.cpp30
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;
+}
+