diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-03 12:36:40 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-03 12:36:40 +0200 |
commit | ab43658c5537c03d075f8abc57fe90e940023779 (patch) | |
tree | 01bd0f73784dd42372dd8a8f065a3a8c6b3d9858 /Kernel/Devices/NullDevice.cpp | |
parent | 072ea7eece8607efec8e2824307b0a6209e4d014 (diff) | |
download | serenity-ab43658c5537c03d075f8abc57fe90e940023779.zip |
Kernel: Move devices into Kernel/Devices/.
Diffstat (limited to 'Kernel/Devices/NullDevice.cpp')
-rw-r--r-- | Kernel/Devices/NullDevice.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Kernel/Devices/NullDevice.cpp b/Kernel/Devices/NullDevice.cpp new file mode 100644 index 0000000000..cfb73450e1 --- /dev/null +++ b/Kernel/Devices/NullDevice.cpp @@ -0,0 +1,38 @@ +#include "NullDevice.h" +#include "Limits.h" +#include <AK/StdLibExtras.h> +#include <AK/kstdio.h> + +static NullDevice* s_the; + +NullDevice& NullDevice::the() +{ + ASSERT(s_the); + return *s_the; +} + +NullDevice::NullDevice() + : CharacterDevice(1, 3) +{ + s_the = this; +} + +NullDevice::~NullDevice() +{ +} + +bool NullDevice::can_read(Process&) const +{ + return true; +} + +ssize_t NullDevice::read(Process&, byte*, ssize_t) +{ + return 0; +} + +ssize_t NullDevice::write(Process&, const byte*, ssize_t buffer_size) +{ + return min(GoodBufferSize, buffer_size); +} + |