mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 05:45:07 +00:00

It still requires an ELF compiler and linker, but at least it builds. I need to get rid of the "Unix" namespace. This does a lot of that.
31 lines
521 B
C++
31 lines
521 B
C++
#include "ZeroDevice.h"
|
|
#include "Limits.h"
|
|
#include <AK/StdLib.h>
|
|
#include <AK/kstdio.h>
|
|
|
|
ZeroDevice::ZeroDevice()
|
|
: CharacterDevice(1, 5)
|
|
{
|
|
}
|
|
|
|
ZeroDevice::~ZeroDevice()
|
|
{
|
|
}
|
|
|
|
bool ZeroDevice::hasDataAvailableForRead() 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);
|
|
}
|
|
|