Print the contents of motd.txt on boot.

This commit is contained in:
Andreas Kling 2018-10-17 12:07:39 +02:00
parent 705832f387
commit 39fa1eb2c2
Notes: sideshowbarker 2024-07-19 18:47:03 +09:00
5 changed files with 28 additions and 8 deletions

View file

@ -5,7 +5,7 @@
#include "UnixTypes.h"
FileHandle::FileHandle(RetainPtr<VirtualFileSystem::Node>&& vnode)
: m_vnode(std::move(vnode))
: m_vnode(move(vnode))
{
}
@ -13,12 +13,14 @@ FileHandle::~FileHandle()
{
}
#ifndef SERENITY_KERNEL
bool additionWouldOverflow(Unix::off_t a, Unix::off_t b)
{
ASSERT(a > 0);
uint64_t ua = a;
return (ua + b) > maxFileOffset;
}
#endif
int FileHandle::stat(Unix::stat* buffer)
{
@ -67,14 +69,17 @@ Unix::off_t FileHandle::seek(Unix::off_t offset, int whence)
break;
case SEEK_CUR:
newOffset = m_currentOffset + offset;
#ifndef SERENITY_KERNEL
if (additionWouldOverflow(m_currentOffset, offset))
return -EOVERFLOW;
#endif
if (newOffset < 0)
return -EINVAL;
break;
case SEEK_END:
// FIXME: Implement!
notImplemented();
newOffset = 0;
break;
default:
return -EINVAL;