mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00:00
32 lines
540 B
C++
32 lines
540 B
C++
#include "ZeroDevice.h"
|
|
#include "Limits.h"
|
|
#include <AK/StdLibExtras.h>
|
|
#include <AK/kstdio.h>
|
|
|
|
ZeroDevice::ZeroDevice()
|
|
: CharacterDevice(1, 5)
|
|
{
|
|
}
|
|
|
|
ZeroDevice::~ZeroDevice()
|
|
{
|
|
}
|
|
|
|
bool ZeroDevice::can_read(Process&) const
|
|
{
|
|
return true;
|
|
}
|
|
|
|
ssize_t ZeroDevice::read(Process&, byte* buffer, size_t bufferSize)
|
|
{
|
|
size_t count = min(GoodBufferSize, bufferSize);
|
|
memset(buffer, 0, count);
|
|
return count;
|
|
}
|
|
|
|
ssize_t ZeroDevice::write(Process&, const byte*, size_t bufferSize)
|
|
{
|
|
return min(GoodBufferSize, bufferSize);
|
|
}
|
|
|