1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

Import very modest Userland.

This commit is contained in:
Andreas Kling 2018-10-22 14:06:22 +02:00
parent 4cbf079a17
commit 63764b3a65
23 changed files with 81 additions and 27 deletions

View file

@ -3,7 +3,7 @@
#include <AK/Retainable.h>
#include <AK/Types.h>
#ifdef SERENITY_KERNEL
#ifdef SERENITY
// FIXME: Support 64-bit DiskOffset
typedef dword DiskOffset;
#else

View file

@ -13,7 +13,7 @@ FileHandle::~FileHandle()
{
}
#ifndef SERENITY_KERNEL
#ifndef SERENITY
bool additionWouldOverflow(Unix::off_t a, Unix::off_t b)
{
ASSERT(a > 0);
@ -69,7 +69,7 @@ Unix::off_t FileHandle::seek(Unix::off_t offset, int whence)
break;
case SEEK_CUR:
newOffset = m_currentOffset + offset;
#ifndef SERENITY_KERNEL
#ifndef SERENITY
if (additionWouldOverflow(m_currentOffset, offset))
return -EOVERFLOW;
#endif

View file

@ -14,7 +14,7 @@ public:
ByteBuffer readEntireFile();
#ifdef SERENITY_KERNEL
#ifdef SERENITY
int fd() const { return m_fd; }
void setFD(int fd) { m_fd = fd; }
#endif
@ -26,7 +26,7 @@ private:
Unix::off_t m_currentOffset { 0 };
#ifdef SERENITY_KERNEL
#ifdef SERENITY
int m_fd { -1 };
#endif
};

View file

@ -2,7 +2,7 @@
#include "UnixTypes.h"
#ifdef SERENITY_KERNEL
#ifdef SERENITY
inline static const Unix::off_t maxFileOffset = 2147483647;
#else
#include <limits>

View file

@ -15,7 +15,7 @@ typedef dword nlink_t;
typedef dword uid_t;
typedef dword gid_t;
#ifdef SERENITY_KERNEL
#ifdef SERENITY
// FIXME: Support 64-bit offsets!
typedef signed_dword off_t;
typedef unsigned int time_t;