blob: e91a3cd68c848676db3fe92b14c28206744bca25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include "NullDevice.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(const FileDescription&) const
{
return true;
}
ssize_t NullDevice::read(FileDescription&, u8*, ssize_t)
{
return 0;
}
ssize_t NullDevice::write(FileDescription&, const u8*, ssize_t buffer_size)
{
return min(PAGE_SIZE, buffer_size);
}
|