mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 09:48:11 +00:00
Kernel: Remove Limits.h
This commit is contained in:
parent
a095a90b51
commit
58c4d41c5f
10 changed files with 9 additions and 24 deletions
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include <AK/Retainable.h>
|
#include <AK/Retainable.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include "Limits.h"
|
|
||||||
#include "FileDescriptor.h"
|
#include "FileDescriptor.h"
|
||||||
|
|
||||||
class Process;
|
class Process;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "FullDevice.h"
|
#include "FullDevice.h"
|
||||||
#include "Limits.h"
|
|
||||||
#include <LibC/errno_numbers.h>
|
#include <LibC/errno_numbers.h>
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
#include <AK/kstdio.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 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);
|
memset(buffer, 0, (size_t)count);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "NullDevice.h"
|
#include "NullDevice.h"
|
||||||
#include "Limits.h"
|
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
#include <AK/kstdio.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)
|
ssize_t NullDevice::write(Process&, const byte*, ssize_t buffer_size)
|
||||||
{
|
{
|
||||||
return min(GoodBufferSize, buffer_size);
|
return min(PAGE_SIZE, buffer_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "RandomDevice.h"
|
#include "RandomDevice.h"
|
||||||
#include "Limits.h"
|
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
|
|
||||||
RandomDevice::RandomDevice()
|
RandomDevice::RandomDevice()
|
||||||
|
@ -42,7 +41,7 @@ bool RandomDevice::can_read(Process&) const
|
||||||
ssize_t RandomDevice::read(Process&, byte* buffer, ssize_t size)
|
ssize_t RandomDevice::read(Process&, byte* buffer, ssize_t size)
|
||||||
{
|
{
|
||||||
const int range = 'z' - 'a';
|
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) {
|
for (ssize_t i = 0; i < nread; ++i) {
|
||||||
dword r = random_value() % range;
|
dword r = random_value() % range;
|
||||||
buffer[i] = (byte)('a' + r);
|
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)
|
ssize_t RandomDevice::write(Process&, const byte*, ssize_t size)
|
||||||
{
|
{
|
||||||
// FIXME: Use input for entropy? I guess that could be a neat feature?
|
// FIXME: Use input for entropy? I guess that could be a neat feature?
|
||||||
return min(GoodBufferSize, size);
|
return min(PAGE_SIZE, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "ZeroDevice.h"
|
#include "ZeroDevice.h"
|
||||||
#include "Limits.h"
|
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
#include <AK/kstdio.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 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);
|
memset(buffer, 0, (size_t)count);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t ZeroDevice::write(Process&, const byte*, ssize_t size)
|
ssize_t ZeroDevice::write(Process&, const byte*, ssize_t size)
|
||||||
{
|
{
|
||||||
return min(GoodBufferSize, size);
|
return min(PAGE_SIZE, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ bool addition_would_overflow(off_t a, off_t b)
|
||||||
{
|
{
|
||||||
ASSERT(a > 0);
|
ASSERT(a > 0);
|
||||||
uint64_t ua = a;
|
uint64_t ua = a;
|
||||||
return (ua + b) > maxFileOffset;
|
return (ua + b) > OFF_T_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
KResult FileDescriptor::fstat(stat& buffer)
|
KResult FileDescriptor::fstat(stat& buffer)
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include <Kernel/Devices/DiskDevice.h>
|
#include <Kernel/Devices/DiskDevice.h>
|
||||||
#include "InodeIdentifier.h"
|
#include "InodeIdentifier.h"
|
||||||
#include "InodeMetadata.h"
|
#include "InodeMetadata.h"
|
||||||
#include "Limits.h"
|
|
||||||
#include "UnixTypes.h"
|
#include "UnixTypes.h"
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/HashMap.h>
|
#include <AK/HashMap.h>
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
#include "InodeIdentifier.h"
|
#include "InodeIdentifier.h"
|
||||||
#include "InodeMetadata.h"
|
#include "InodeMetadata.h"
|
||||||
#include "Limits.h"
|
|
||||||
#include "FileSystem.h"
|
#include "FileSystem.h"
|
||||||
#include <Kernel/KResult.h>
|
#include <Kernel/KResult.h>
|
||||||
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "UnixTypes.h"
|
|
||||||
|
|
||||||
inline static const off_t maxFileOffset = 2147483647;
|
|
||||||
|
|
||||||
static const ssize_t GoodBufferSize = 4096;
|
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,8 @@ struct sigaction {
|
||||||
#define SIG_UNBLOCK 1
|
#define SIG_UNBLOCK 1
|
||||||
#define SIG_SETMASK 2
|
#define SIG_SETMASK 2
|
||||||
|
|
||||||
// FIXME: Support 64-bit offsets!
|
#define OFF_T_MAX 2147483647
|
||||||
|
|
||||||
typedef signed_dword off_t;
|
typedef signed_dword off_t;
|
||||||
typedef dword time_t;
|
typedef dword time_t;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue