2018-10-14 00:59:22 +00:00
|
|
|
#include "NullDevice.h"
|
|
|
|
#include "Limits.h"
|
2018-12-03 23:27:16 +00:00
|
|
|
#include <AK/StdLibExtras.h>
|
2018-10-16 12:33:16 +00:00
|
|
|
#include <AK/kstdio.h>
|
2018-10-14 00:59:22 +00:00
|
|
|
|
2019-02-12 10:25:25 +00:00
|
|
|
static NullDevice* s_the;
|
|
|
|
|
|
|
|
NullDevice& NullDevice::the()
|
|
|
|
{
|
|
|
|
ASSERT(s_the);
|
|
|
|
return *s_the;
|
|
|
|
}
|
|
|
|
|
2018-10-14 00:59:22 +00:00
|
|
|
NullDevice::NullDevice()
|
2018-10-30 12:59:29 +00:00
|
|
|
: CharacterDevice(1, 3)
|
2018-10-14 00:59:22 +00:00
|
|
|
{
|
2019-02-12 10:25:25 +00:00
|
|
|
s_the = this;
|
2018-10-14 00:59:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NullDevice::~NullDevice()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-01-15 23:10:13 +00:00
|
|
|
bool NullDevice::can_read(Process&) const
|
2018-10-25 11:07:59 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-01-15 23:20:38 +00:00
|
|
|
ssize_t NullDevice::read(Process&, byte*, size_t)
|
2018-10-14 00:59:22 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-01-15 23:20:38 +00:00
|
|
|
ssize_t NullDevice::write(Process&, const byte*, size_t bufferSize)
|
2018-10-14 00:59:22 +00:00
|
|
|
{
|
|
|
|
return min(GoodBufferSize, bufferSize);
|
|
|
|
}
|
|
|
|
|