1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

Kernel: Remove Limits.h

This commit is contained in:
Andreas Kling 2019-04-03 13:18:42 +02:00
parent a095a90b51
commit 58c4d41c5f
10 changed files with 9 additions and 24 deletions

View file

@ -2,7 +2,6 @@
#include <AK/Retainable.h>
#include <AK/Types.h>
#include "Limits.h"
#include "FileDescriptor.h"
class Process;

View file

@ -1,5 +1,4 @@
#include "FullDevice.h"
#include "Limits.h"
#include <LibC/errno_numbers.h>
#include <AK/StdLibExtras.h>
#include <AK/kstdio.h>
@ -20,7 +19,7 @@ bool FullDevice::can_read(Process&) const
ssize_t FullDevice::read(Process&, byte* buffer, ssize_t size)
{
ssize_t count = min(GoodBufferSize, size);
ssize_t count = min(PAGE_SIZE, size);
memset(buffer, 0, (size_t)count);
return count;
}

View file

@ -1,5 +1,4 @@
#include "NullDevice.h"
#include "Limits.h"
#include <AK/StdLibExtras.h>
#include <AK/kstdio.h>
@ -33,6 +32,6 @@ ssize_t NullDevice::read(Process&, byte*, ssize_t)
ssize_t NullDevice::write(Process&, const byte*, ssize_t buffer_size)
{
return min(GoodBufferSize, buffer_size);
return min(PAGE_SIZE, buffer_size);
}

View file

@ -1,5 +1,4 @@
#include "RandomDevice.h"
#include "Limits.h"
#include <AK/StdLibExtras.h>
RandomDevice::RandomDevice()
@ -42,7 +41,7 @@ bool RandomDevice::can_read(Process&) const
ssize_t RandomDevice::read(Process&, byte* buffer, ssize_t size)
{
const int range = 'z' - 'a';
ssize_t nread = min(size, GoodBufferSize);
ssize_t nread = min(size, PAGE_SIZE);
for (ssize_t i = 0; i < nread; ++i) {
dword r = random_value() % range;
buffer[i] = (byte)('a' + r);
@ -53,6 +52,6 @@ ssize_t RandomDevice::read(Process&, byte* buffer, ssize_t size)
ssize_t RandomDevice::write(Process&, const byte*, ssize_t size)
{
// FIXME: Use input for entropy? I guess that could be a neat feature?
return min(GoodBufferSize, size);
return min(PAGE_SIZE, size);
}

View file

@ -1,5 +1,4 @@
#include "ZeroDevice.h"
#include "Limits.h"
#include <AK/StdLibExtras.h>
#include <AK/kstdio.h>
@ -19,13 +18,13 @@ bool ZeroDevice::can_read(Process&) const
ssize_t ZeroDevice::read(Process&, byte* buffer, ssize_t size)
{
ssize_t count = min(GoodBufferSize, size);
ssize_t count = min(PAGE_SIZE, size);
memset(buffer, 0, (size_t)count);
return count;
}
ssize_t ZeroDevice::write(Process&, const byte*, ssize_t size)
{
return min(GoodBufferSize, size);
return min(PAGE_SIZE, size);
}