mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
31 lines
534 B
C++
31 lines
534 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::has_data_available_for_reading() const
|
|
{
|
|
return true;
|
|
}
|
|
|
|
ssize_t ZeroDevice::read(byte* buffer, size_t bufferSize)
|
|
{
|
|
size_t count = min(GoodBufferSize, bufferSize);
|
|
memset(buffer, 0, count);
|
|
return count;
|
|
}
|
|
|
|
ssize_t ZeroDevice::write(const byte*, size_t bufferSize)
|
|
{
|
|
return min(GoodBufferSize, bufferSize);
|
|
}
|
|
|