From 493f449d1d3a64bd193cbd2703f8f627012e5b67 Mon Sep 17 00:00:00 2001 From: J Reece Wilson Date: Fri, 23 Feb 2024 12:44:43 +0000 Subject: [PATCH] [*] Major Linux build regressions --- Include/Aurora/Async/AsyncTypes.hpp | 2 +- Include/Aurora/Debug/SysErrors.hpp | 4 ++-- Include/Aurora/Debug/SysPanic.hpp | 24 ------------------------ Source/AuProcAddresses.Linux.cpp | 2 +- Source/AuProcAddresses.Linux.hpp | 5 +++++ Source/AuProcAddresses.cpp | 4 ++++ Source/IO/AuIOHandle.cpp | 2 +- Source/IO/FS/Async.Linux.hpp | 1 + Source/IO/IPC/AuIPCPipe.Unix.cpp | 6 +++--- Source/IO/Loop/LSEvent.Linux.cpp | 2 +- Source/IO/Net/AuNetSocket.cpp | 4 ++-- Source/IO/Net/AuNetStream.Linux.cpp | 4 +--- Source/IO/Net/AuNetStream.Linux.hpp | 3 +++ Source/IO/UNIX/IOSubmit.Linux.cpp | 4 +++- Source/IO/UNIX/IOSubmit.Linux.hpp | 5 +++-- Source/Process/AuProcessMap.Linux.cpp | 5 ++++- Source/Processes/AuProcess.Unix.cpp | 1 - 17 files changed, 35 insertions(+), 43 deletions(-) diff --git a/Include/Aurora/Async/AsyncTypes.hpp b/Include/Aurora/Async/AsyncTypes.hpp index a24f4686..a13de0ec 100644 --- a/Include/Aurora/Async/AsyncTypes.hpp +++ b/Include/Aurora/Async/AsyncTypes.hpp @@ -110,7 +110,7 @@ namespace Aurora::Async inline bool operator==(const WorkerPId_t &in) const noexcept { - return in.GetPool() == this->GetPool() && + return in.GetPool().get() == this->GetPool().get() && in.first == this->first && this->second == in.second; } diff --git a/Include/Aurora/Debug/SysErrors.hpp b/Include/Aurora/Debug/SysErrors.hpp index d3c8bd89..da74f9c2 100644 --- a/Include/Aurora/Debug/SysErrors.hpp +++ b/Include/Aurora/Debug/SysErrors.hpp @@ -100,12 +100,12 @@ namespace Aurora::Debug } } - AU_INLINE void SysPushError(EFailureCategory category, const AuString &str) + static AU_INLINE void SysPushError(EFailureCategory category, const AuString &str) { _PushError(GetIPNoBackend(), category, str.c_str()); } - AU_INLINE void SysPushError(EFailureCategory category, AuUInt16 uLineHint, const AuString &str) + static AU_INLINE void SysPushError(EFailureCategory category, AuUInt16 uLineHint, const AuString &str) { _PushError(GetIPNoBackend(), category, str.c_str(), uLineHint); } diff --git a/Include/Aurora/Debug/SysPanic.hpp b/Include/Aurora/Debug/SysPanic.hpp index d403173c..a3b6c3d1 100644 --- a/Include/Aurora/Debug/SysPanic.hpp +++ b/Include/Aurora/Debug/SysPanic.hpp @@ -53,36 +53,12 @@ static inline void AU_NORETURN SysPanic2(AuUInt uLineHintInNonshipBinary, template static inline void AU_NORETURN SysPanic() { - if (Aurora::RuntimeHasStarted()) - { - Aurora::Debug::AddMemoryCrunch(); - try - { - Aurora::Logging::WriteLinef(static_cast(Aurora::Logging::ELogLevel::eError), Aurora::Console::EAnsiColor::eBoldRed, "Fatal"); - } - catch (...) - { - - } - } Aurora::Debug::Panic(); } template static inline void AU_NORETURN SysPanic2(AuUInt uLineHintInNonshipBinary) { - if (Aurora::RuntimeHasStarted()) - { - Aurora::Debug::AddMemoryCrunch(); - try - { - Aurora::Logging::WriteLinef(static_cast(Aurora::Logging::ELogLevel::eError), Aurora::Console::EAnsiColor::eBoldRed, "Fatal"); - } - catch (...) - { - - } - } Aurora::Debug::Panic2(uLineHintInNonshipBinary); } diff --git a/Source/AuProcAddresses.Linux.cpp b/Source/AuProcAddresses.Linux.cpp index 572aff9e..b7959b8c 100644 --- a/Source/AuProcAddresses.Linux.cpp +++ b/Source/AuProcAddresses.Linux.cpp @@ -23,7 +23,7 @@ namespace Aurora void InitLinuxAddresses() { - + pgetsockname = getsockname; } template diff --git a/Source/AuProcAddresses.Linux.hpp b/Source/AuProcAddresses.Linux.hpp index bb84567c..c4588350 100644 --- a/Source/AuProcAddresses.Linux.hpp +++ b/Source/AuProcAddresses.Linux.hpp @@ -8,6 +8,7 @@ #pragma once #include +#include struct robust_list_head; @@ -60,4 +61,8 @@ namespace Aurora int close_range(unsigned int first, unsigned int last, unsigned int flags); + + inline int (*pgetsockname)(int sockfd, struct sockaddr *addr, + socklen_t *addrlen); + } \ No newline at end of file diff --git a/Source/AuProcAddresses.cpp b/Source/AuProcAddresses.cpp index ef7454bf..42548ce3 100644 --- a/Source/AuProcAddresses.cpp +++ b/Source/AuProcAddresses.cpp @@ -24,5 +24,9 @@ namespace Aurora #if defined(AURORA_IS_MODERNNT_DERIVED) InitNTAddresses(); #endif + + #if defined(AURORA_IS_LINUX_DERIVED) + InitLinuxAddresses(); + #endif } } \ No newline at end of file diff --git a/Source/IO/AuIOHandle.cpp b/Source/IO/AuIOHandle.cpp index 94fece78..65eaacef 100644 --- a/Source/IO/AuIOHandle.cpp +++ b/Source/IO/AuIOHandle.cpp @@ -361,7 +361,7 @@ namespace Aurora::IO #endif #if defined(AURORA_IS_POSIX_DERIVED) - handle = UNIX::ShareFileDescriptor((HANDLE)this->GetOSHandleSafe().ValueOr(-1)); + handle = UNIX::ShareFileDescriptor(this->GetOSHandleSafe().ValueOr(-1)); #endif if (handle.empty()) diff --git a/Source/IO/FS/Async.Linux.hpp b/Source/IO/FS/Async.Linux.hpp index a5850f7d..2cf598b4 100644 --- a/Source/IO/FS/Async.Linux.hpp +++ b/Source/IO/FS/Async.Linux.hpp @@ -77,6 +77,7 @@ namespace Aurora::IO::FS virtual void LIOS_Process(AuUInt32 read, bool failure, int err, bool mark) override; + AuSPtr pProcessBlock_; private: AuSPtr pHandle_; AuUInt64 lastAbstractOffset_ {}; diff --git a/Source/IO/IPC/AuIPCPipe.Unix.cpp b/Source/IO/IPC/AuIPCPipe.Unix.cpp index 5fd7be6e..f7a8b851 100644 --- a/Source/IO/IPC/AuIPCPipe.Unix.cpp +++ b/Source/IO/IPC/AuIPCPipe.Unix.cpp @@ -325,7 +325,7 @@ namespace Aurora::IO::IPC { if (!nonblock) { - SysPushErrorNested("File Error: {}", this->pHandle_->GetPath()); + SysPushErrorNested("File Error: {}", this->fsHandle_->GetPath()); } return nonblock; @@ -340,7 +340,7 @@ namespace Aurora::IO::IPC return nonblock; } - read.outVariable = tmp; + read.outVariable = offset; return true; } @@ -507,7 +507,7 @@ namespace Aurora::IO::IPC return {}; } - if (object->bDead) + if (handle->bDead) { return {}; } diff --git a/Source/IO/Loop/LSEvent.Linux.cpp b/Source/IO/Loop/LSEvent.Linux.cpp index d98baa39..b660542c 100644 --- a/Source/IO/Loop/LSEvent.Linux.cpp +++ b/Source/IO/Loop/LSEvent.Linux.cpp @@ -35,7 +35,7 @@ namespace Aurora::IO::Loop } } - bool TryInit(bool bTriggered, bool bAtomicRelease, bool bPermitMultipleTriggers) + bool LSEvent::TryInit(bool bTriggered, bool bAtomicRelease, bool bPermitMultipleTriggers) { this->handle = ::eventfd(bTriggered ? 1 : 0, EFD_NONBLOCK | EFD_CLOEXEC); this->atomicRelease_ = bAtomicRelease; diff --git a/Source/IO/Net/AuNetSocket.cpp b/Source/IO/Net/AuNetSocket.cpp index 25b57128..6a6cd33f 100644 --- a/Source/IO/Net/AuNetSocket.cpp +++ b/Source/IO/Net/AuNetSocket.cpp @@ -510,7 +510,7 @@ namespace Aurora::IO::Net #if defined(AURORA_IS_MODERNNT_DERIVED) AuStaticCast(this->socketChannel_.inputChannel.pNetReadTransaction)->HasErrorCode() #else - this->socketChannel_.inputChannel.pNetReadTransaction->Failed() + this->socketChannel_.inputChannel.pNetReadTransaction->HasFailed() #endif ) { @@ -520,7 +520,7 @@ namespace Aurora::IO::Net #if defined(AURORA_IS_MODERNNT_DERIVED) AuStaticCast(this->socketChannel_.outputChannel.pNetWriteTransaction_)->HasErrorCode() #else - this->socketChannel_.outputChannel.pNetWriteTransaction_->Failed() + this->socketChannel_.outputChannel.pNetWriteTransaction_->HasFailed() #endif ) { diff --git a/Source/IO/Net/AuNetStream.Linux.cpp b/Source/IO/Net/AuNetStream.Linux.cpp index a9c1e507..84099a02 100644 --- a/Source/IO/Net/AuNetStream.Linux.cpp +++ b/Source/IO/Net/AuNetStream.Linux.cpp @@ -253,7 +253,6 @@ namespace Aurora::IO::Net return false; } - this->overlap.hEvent = (HANDLE)AuStaticCast(pLoopSource)->GetHandle(); pCompletionGroup->AddWorkItem(this->SharedFromThis()); this->pCompletionGroup_ = pCompletionGroup; return true; @@ -372,7 +371,6 @@ namespace Aurora::IO::Net bool LinuxAsyncNetworkTransaction::IDontWannaUsePorts() { - return true; } @@ -406,7 +404,7 @@ namespace Aurora::IO::Net return this->pSocket->ToPlatformHandle(); } - int NtAsyncNetworkTransaction::GetAlertable() + int LinuxAsyncNetworkTransaction::GetAlertable() { if (this->pCompletionGroup_) { diff --git a/Source/IO/Net/AuNetStream.Linux.hpp b/Source/IO/Net/AuNetStream.Linux.hpp index 0ae35a48..a6d1314d 100644 --- a/Source/IO/Net/AuNetStream.Linux.hpp +++ b/Source/IO/Net/AuNetStream.Linux.hpp @@ -51,6 +51,9 @@ namespace Aurora::IO::Net virtual void LIOS_Process(AuUInt32 read, bool failure, int err, bool mark) override; + bool HasCompletedForGCWI() override; + void CleanupForGCWI() override; + void MakeSyncable(); void ForceNextWriteWait(); diff --git a/Source/IO/UNIX/IOSubmit.Linux.cpp b/Source/IO/UNIX/IOSubmit.Linux.cpp index e8855f4a..243c35f7 100644 --- a/Source/IO/UNIX/IOSubmit.Linux.cpp +++ b/Source/IO/UNIX/IOSubmit.Linux.cpp @@ -439,8 +439,10 @@ namespace Aurora::IO::UNIX { #endif context->LIOS_SendProcess(bytesTransacted, bError, iErrNo); + #if 0 } - + #endif + return true; } diff --git a/Source/IO/UNIX/IOSubmit.Linux.hpp b/Source/IO/UNIX/IOSubmit.Linux.hpp index ea06e8fb..1dbd7d68 100644 --- a/Source/IO/UNIX/IOSubmit.Linux.hpp +++ b/Source/IO/UNIX/IOSubmit.Linux.hpp @@ -43,11 +43,12 @@ namespace Aurora::IO::UNIX AuLoop::ILSEvent *optEvent2 {}; aio_context_t abortContext {}; + // TODO: + AuSPtr pin_; + AuSPtr memPin_; private: AuUInt64 dataPtr_ {}; AuUInt dataLen_ {}; - AuSPtr pin_; - AuSPtr memPin_; int tempEPoll {-1}; iocb cb {}; }; diff --git a/Source/Process/AuProcessMap.Linux.cpp b/Source/Process/AuProcessMap.Linux.cpp index 540728e5..f263beee 100644 --- a/Source/Process/AuProcessMap.Linux.cpp +++ b/Source/Process/AuProcessMap.Linux.cpp @@ -39,7 +39,10 @@ namespace Aurora::Process AuString fileName = info->dlpi_name[0] ? info->dlpi_name : AuString{}; if (fileName.empty()) { - GetProcFullPath(fileName); + if (auto optProcessPath = GetProcessFullPath()) + { + fileName = *optProcessPath; + } } if (!AuIOFS::FileExists(fileName)) diff --git a/Source/Processes/AuProcess.Unix.cpp b/Source/Processes/AuProcess.Unix.cpp index 53269d7f..7bf1408b 100644 --- a/Source/Processes/AuProcess.Unix.cpp +++ b/Source/Processes/AuProcess.Unix.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #if defined(AURORA_COMPILER_CLANG)