[*] Linux build errors

This commit is contained in:
Reece Wilson 2022-06-12 14:53:35 +01:00
parent 5d2b642ac0
commit b029f7692f
14 changed files with 78 additions and 27 deletions

View File

@ -66,15 +66,15 @@ namespace Aurora::Async
{
if (!frame)
{
info.type = IWorkItemHandler::ETickType::eFinished;
info.type = ETickType::eFinished;
return;
}
}
frame();
info.type = IWorkItemHandler::ETickType::eFinished;
info.type = ETickType::eFinished;
}
void Shutdown() override
void OnFailure() override
{
if constexpr (AuIsBaseOfTemplate<AuFunction, Cleanup_t>::value)
{

View File

@ -28,10 +28,12 @@ namespace Aurora::Console::ConsoleTTY
gIsBuffering = true;
}
void EndBuffering()
bool EndBuffering()
{
ConsoleStd::Unlock();
gIsBuffering = false;
//TODO (Reece): Was signal handler called?
return true;
}
static void TTYWrite(const AuString &in)
@ -242,6 +244,23 @@ namespace Aurora::Console::ConsoleTTY
TTYWrite(fmt::format("\033[{:1};{:0}H", position.first + 1, position.second + 1));
}
AUKN_SYM void TTYScrollBuffer(int Y)
{
if (Y == 0)
{
return;
}
if (Y)
{
TTYWrite(fmt::format("\033[{:0}S", Y));
}
else
{
TTYWrite(fmt::format("\033[{:0}T", 0 - Y));
}
}
void InitUnix()
{
// TODO: consider capturing the signal to update a global row/cols variable

View File

@ -11,5 +11,5 @@ namespace Aurora::Console
{
bool IsBuffering();
void BeginBuffering();
void EndBuffering();
bool EndBuffering();
}

View File

@ -5,6 +5,7 @@
Date: 2022-5-11
Author: Reece
***/
#define I_REALLY_NEED_WIDECHAR_PUBAPI // bc linux
#include <Source/RuntimeInternal.hpp>
#include <Source/Console/Console.hpp>
#include "ConsoleTTY.hpp"

View File

@ -19,6 +19,17 @@
namespace Aurora::IO::FS
{
struct LinuxAsyncFileTransactionLoopSource : Aurora::IO::Loop::LSEvent
{
LinuxAsyncFileTransactionLoopSource(AuSPtr<LinuxAsyncFileTransaction> that);
virtual bool IsSignaled() override;
virtual bool OnTrigger(AuUInt handle) override;
virtual AuLoop::ELoopSource GetType() override;
private:
AuWPtr<LinuxAsyncFileTransaction> caller_;
};
LinuxAsyncFileTransactionLoopSource::LinuxAsyncFileTransactionLoopSource(AuSPtr<LinuxAsyncFileTransaction> that) : caller_(that), Loop::LSEvent(false, false, true)
{
@ -201,6 +212,7 @@ namespace Aurora::IO::FS
}
this->latch_ = false;
this->hasError_ = false;
this->bTxFinished_ = false;
this->lastFinishedStat_ = 0;
@ -250,6 +262,7 @@ namespace Aurora::IO::FS
this->latch_ = false;
this->bTxFinished_ = false;
this->hasError_ = false;
this->lastFinishedStat_ = 0;
if (!this->loopSource_)
@ -292,6 +305,8 @@ namespace Aurora::IO::FS
void LinuxAsyncFileTransaction::LIOS_Process(AuUInt32 read, bool failure, int err, bool mark)
{
this->lastFinishedStat_ = failure ? 0 : read;
this->hasError_ = failure;
this->error_ = err;
this->bTxFinished_ = true;
if (mark)
{
@ -329,6 +344,16 @@ namespace Aurora::IO::FS
return false;
}
bool LinuxAsyncFileTransaction::Failed()
{
return this->hasError_;
}
AuUInt LinuxAsyncFileTransaction::GetOSErrorCode()
{
return AuUInt(this->error_);
}
AuUInt32 LinuxAsyncFileTransaction::GetLastPacketLength()
{
return this->lastFinishedStat_;

View File

@ -10,17 +10,7 @@
namespace Aurora::IO::FS
{
struct LinuxAsyncFileTransaction;
struct LinuxAsyncFileTransactionLoopSource : AuLoop::LSEvent
{
LinuxAsyncFileTransactionLoopSource(AuSPtr<LinuxAsyncFileTransaction> that);
virtual bool IsSignaled() override;
virtual bool OnTrigger(AuUInt handle) override;
virtual AuLoop::ELoopSource GetType() override;
private:
AuWPtr<LinuxAsyncFileTransaction> caller_;
};
struct LinuxAsyncFileTransactionLoopSource;
struct FileHandle
{
@ -62,6 +52,9 @@ namespace Aurora::IO::FS
bool StartRead(AuUInt64 offset, const AuSPtr<AuMemoryViewWrite> &memoryView) override;
bool StartWrite(AuUInt64 offset, const AuSPtr<AuMemoryViewRead> &memoryView) override;
bool Failed() override;
AuUInt GetOSErrorCode() override;
bool Complete() override;
AuUInt32 GetLastPacketLength() override;
@ -84,5 +77,7 @@ namespace Aurora::IO::FS
bool bTxFinished_ {};
AuSPtr<IAsyncFinishedSubscriber> sub_;
AuSPtr<LinuxAsyncFileTransactionLoopSource> loopSource_;
int error_ {};
bool hasError_ {};
};
}

View File

@ -10,7 +10,7 @@
#include "Watcher.Linux.hpp"
#include <sys/inotify.h>
#include <Source/Loop/LSHandle.hpp>
#include <Source/IO/Loop/LSHandle.hpp>
namespace Aurora::IO::FS
{

View File

@ -545,7 +545,7 @@ namespace Aurora::IO
void IOProcessor::CancelWorkItem()
{
this->workItem->Cancel();
this->workItem = {};
this->workItem.reset();
}
void IOProcessor::RemoveLSTimer()

View File

@ -56,4 +56,10 @@ namespace Aurora::IO
return bHit;
}
AUKN_SYM bool IOYield()
{
AuLogWarn("TODO");
return false;
}
}

View File

@ -7,7 +7,7 @@
***/
#pragma once
#include <Source/IPC/IPCHandle.hpp>
#include <Source/IO/IPC/IPCHandle.hpp>
namespace Aurora::IO::UNIX
{

View File

@ -15,8 +15,8 @@
#include <arpa/inet.h>
#include "IOSubmit.Linux.hpp"
#include <Source/Time/Time.hpp>
#include <Source/Loop/Loop.hpp>
#include <Source/Loop/LSEvent.hpp>
#include <Source/IO/Loop/Loop.hpp>
#include <Source/IO/Loop/LSEvent.hpp>
static int io_setup(unsigned nr, aio_context_t *ctxp)
{

View File

@ -8,8 +8,12 @@
#include <Source/RuntimeInternal.hpp>
#include "IO.hpp"
#include "WaitMultiple.Linux.hpp"
#include "FS/Async.Linux.hpp"
#include <Source/IO/Loop/Loop.hpp>
#include <Source/IO/Loop/LSHandle.hpp>
#include <Source/IO/Loop/LSEvent.hpp>
#include "UNIX/IOSubmit.Linux.hpp"
#include "FS/Async.Linux.hpp"
namespace Aurora::IO
{
@ -83,7 +87,8 @@ namespace Aurora::IO
auto waitQueue = AuTryConstruct<AuList<AuSPtr<IAsyncTransaction>>>(code, transactions);
if (!code)
{
return 0;
SysPushErrorMem();
return {};
}
while (true)

View File

@ -148,7 +148,7 @@ namespace Aurora::Processes
return this->finished_;
}
AuSPtr<Loop::ILoopSource> ProcessImpl::AsLoopSource()
AuSPtr<AuLoop::ILoopSource> ProcessImpl::AsLoopSource()
{
return this->loopSource_;
}

View File

@ -8,7 +8,7 @@
***/
#pragma once
#include <Source/Loop/LSEvent.hpp>
#include <Source/IO/Loop/LSEvent.hpp>
#include <Source/IO/FS/FS.hpp>
#if defined(AURORA_IS_LINUX_DERIVED)
@ -35,7 +35,7 @@ namespace Aurora::Processes
bool TryKill() override;
bool Terminate() override;
AuSPtr<Threading::IWaitable> AsWaitable() override;
AuSPtr<Loop::ILoopSource> AsLoopSource() override;
AuSPtr<IO::Loop::ILoopSource> AsLoopSource() override;
AuSInt GetExitCode() override;
@ -58,7 +58,7 @@ namespace Aurora::Processes
int pipeStdErr_[2]{};
int pipeStdIn_ [2]{};
AuSPtr<Loop::ILSEvent> loopSource_;
AuSPtr<IO::Loop::ILSEvent> loopSource_;
AuSPtr<IO::FS::FileHandle> fsHandle_;
AuSPtr<ProcessPipeFileStream> fsStream_;