mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 12:15:07 +00:00
Add a simple /dev/full.
This commit is contained in:
parent
fc1facf5c0
commit
9f9b4a2382
6 changed files with 85 additions and 0 deletions
30
VirtualFileSystem/FullDevice.cpp
Normal file
30
VirtualFileSystem/FullDevice.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include "FullDevice.h"
|
||||
#include "Limits.h"
|
||||
#include "sys-errno.h"
|
||||
#include <AK/StdLib.h>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
|
||||
FullDevice::FullDevice()
|
||||
{
|
||||
}
|
||||
|
||||
FullDevice::~FullDevice()
|
||||
{
|
||||
}
|
||||
|
||||
ssize_t FullDevice::read(byte* buffer, size_t bufferSize)
|
||||
{
|
||||
printf("read from full device\n");
|
||||
size_t count = min(GoodBufferSize, bufferSize);
|
||||
memset(buffer, 0, count);
|
||||
return count;
|
||||
}
|
||||
|
||||
ssize_t FullDevice::write(const byte*, size_t bufferSize)
|
||||
{
|
||||
if (bufferSize == 0)
|
||||
return 0;
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue