mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-30 16:28:48 +00:00
Print the contents of motd.txt on boot.
This commit is contained in:
parent
705832f387
commit
39fa1eb2c2
Notes:
sideshowbarker
2024-07-19 18:47:03 +09:00
Author: https://github.com/awesomekling
Commit: 39fa1eb2c2
5 changed files with 28 additions and 8 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue