1
Fork 0
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:
Andreas Kling 2018-10-14 13:16:09 +02:00
parent fc1facf5c0
commit 9f9b4a2382
6 changed files with 85 additions and 0 deletions

View 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;
}