mirror of
https://github.com/RGBCube/serenity
synced 2025-07-05 22:47:35 +00:00
Add basic character device support. Start with null and zero.
This commit is contained in:
parent
fa3b11ac64
commit
93556d6743
14 changed files with 157 additions and 2 deletions
27
VirtualFileSystem/ZeroDevice.cpp
Normal file
27
VirtualFileSystem/ZeroDevice.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include "ZeroDevice.h"
|
||||
#include "Limits.h"
|
||||
#include <AK/StdLib.h>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
|
||||
ZeroDevice::ZeroDevice()
|
||||
{
|
||||
}
|
||||
|
||||
ZeroDevice::~ZeroDevice()
|
||||
{
|
||||
}
|
||||
|
||||
ssize_t ZeroDevice::read(byte* buffer, size_t bufferSize)
|
||||
{
|
||||
printf("read from zero device\n");
|
||||
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);
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue