[+] LSFromFdNonblocking

[*] Other Linux progression
This commit is contained in:
Reece Wilson 2022-04-05 03:36:39 +01:00
parent c4d9042e44
commit 48b6994f61
13 changed files with 72 additions and 20 deletions

View File

@ -42,7 +42,7 @@ namespace Aurora::IO::FS
// The only way you can break this assumption is if you argue for users who will be outside of our deployment pipeline, wanting global configs, and don't have write permission on a relevant global directory.
// They can shove it. Superuser should install software for all users.
// XDG (falling back to home) for non-root installs; for root installs, installing a service package, use /var; for root installs of an application whose system configs should be shared amongst all users, unsupported, idc, it's sandboxed per user
static const AuString kUnixAppData {"/var"};
static const char * kUnixAppData {"/var"};
AUKN_SYM bool GetSystemDomain(AuString &path)
{

View File

@ -25,12 +25,17 @@ namespace Aurora::Logging
{
AUKN_SYM IBasicSink *NewStdSinkNew()
{
#if defined(AURORA_IS_MODERNNT_DERIVED)
return Sinks::NewStdSinkNew();
#endif
return {};
}
AUKN_SYM void NewStdSinkRelease(IBasicSink *sink)
{
#if defined(AURORA_IS_MODERNNT_DERIVED)
Sinks::NewStdSinkRelease(sink);
#endif
}
AUKN_SYM IBasicSink *NewOSEventDirectorySinkNew()

View File

@ -7,6 +7,7 @@
***/
#include <Source/RuntimeInternal.hpp>
#include "LSEvent.hpp"
#include "LSFromFdNonblocking.hpp"
namespace Aurora::Loop
{
@ -56,6 +57,11 @@ namespace Aurora::Loop
}
bool LSEvent::IsSignaled()
{
return IsSignaledFromNonblockingImpl(this, this, &LSEvent::IsSignaledNonblocking);
}
bool LSEvent::IsSignaledNonblocking()
{
if (!this->atomicRelease_)
{

View File

@ -24,6 +24,7 @@ namespace Aurora::Loop
private:
void Init(bool init);
bool IsSignaledNonblocking();
bool atomicRelease_;
};
}

View File

@ -19,5 +19,8 @@ namespace Aurora::Loop
bool ILSEvent::IsSignaled() override;
virtual ELoopSource ILSEvent::GetType() override;
bool IsSignaledNonblocking() override;
};
}

View File

@ -0,0 +1,25 @@
/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LSFromFdNonblocking.cpp
Date: 2022-4-4
Author: Reece
***/
#pragma once
namespace Aurora::Loop
{
template<typename T>
inline void IsSignaledFromNonblockingImpl(ILoopSourceEx *source, T * that, bool(T *::IsSignaledNonblocking)())
{
bool val {};
source->OnPresleep();
val = ((that).*(IsSignaledNonblocking))();
if (val)
{
val = this->OnTrigger(one);
}
source->OnFinishSleep();
return val;
}
}

View File

@ -8,6 +8,7 @@
***/
#include <Source/RuntimeInternal.hpp>
#include "LSMutex.hpp"
#include "LSFromFdNonblocking.hpp"
namespace Aurora::Loop
{
@ -35,6 +36,11 @@ namespace Aurora::Loop
}
bool LSMutex::IsSignaled()
{
return IsSignaledFromNonblockingImpl(this, this, &LSMutex::IsSignaledNonblocking);
}
bool LSMutex::IsSignaledNonblocking()
{
AuUInt64 oldSemaphoreValue {};
auto ok = read(this->handle, &oldSemaphoreValue, sizeof(oldSemaphoreValue)) == 8;

View File

@ -23,5 +23,6 @@ namespace Aurora::Loop
private:
void Init();
bool IsSignaledNonblocking();
};
}

View File

@ -1,13 +0,0 @@
/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: WaitSingle.Linux.hpp
Date: 2022-3-22
Author: Reece
***/
#pragma once
namespace Aurora::Loop
{
}

View File

@ -10,6 +10,7 @@
#if defined(AURORA_IS_POSIX_DERIVED)
#include <stdlib.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/stat.h>
#endif
@ -85,7 +86,7 @@ namespace Aurora::Process
}
}
static constexpr AuString ConstructAuDllSuffix()
static AuString ConstructAuDllSuffixUncached()
{
auto platform = GetPlatformString(Build::kCurrentPlatform);
auto architecture = GetArchString(Build::kCurrentArchitecture);
@ -119,6 +120,14 @@ namespace Aurora::Process
return ret;
}
static const AuString& ConstructAuDllSuffix()
{
static AuString dllSuffixString {};
if (dllSuffixString.empty()) dllSuffixString = ConstructAuDllSuffix();
dllSuffixString = ConstructAuDllSuffixUncached();
return dllSuffixString;
}
#if defined(AURORA_PLATFORM_WIN32)
bool VerifyEmbeddedSignature(const wchar_t *path, HANDLE handle)
{
@ -151,7 +160,7 @@ namespace Aurora::Process
// Disable WVT UI.
WinTrustData.dwUIChoice = WTD_UI_NONE;
// Revocation checking.
// Revocation checking.constexpr
WinTrustData.fdwRevocationChecks = WTD_REVOKE_WHOLECHAIN;
// Verify an embedded signature on a file.

View File

@ -175,7 +175,10 @@ namespace Aurora::Process
void DeinitProcessMap()
{
gMutexUnique.reset();
#if defined(AURORA_IS_MODERNNT_DERIVED)
DeinitProcessMapNt();
#endif
}
AUKN_SYM AuOptional<Section> GetSection(AuUInt pointer)
@ -211,7 +214,10 @@ namespace Aurora::Process
{
try
{
#if defined(AURORA_IS_MODERNNT_DERIVED)
return GetExecutableRoot();
#endif
return {};
}
catch (...)
{

View File

@ -7,8 +7,11 @@
***/
#include <Source/RuntimeInternal.hpp>
#include "Processes.hpp"
#include "Process.Win32.hpp"
#include "Open.Win32.hpp"
#if defined (AURORA_PLATFORM_WIN32)
#include "Process.Win32.hpp"
#include "Open.Win32.hpp"
#endif
namespace Aurora::Processes
{

View File

@ -54,9 +54,9 @@ namespace Aurora::Threading::Threads
return {false, 0};
}
if (info_.stackSize)
if (staskSize)
{
ret = pthread_attr_setstacksize(&tattr, AuMax(AuUInt32(PTHREAD_STACK_MIN), AuUInt32(info_.stackSize)));
ret = pthread_attr_setstacksize(&tattr, AuMax(AuUInt32(PTHREAD_STACK_MIN), AuUInt32(staskSize)));
if (ret != 0)
{
SysPushErrorGen("Couldn't create thread: {}", debugString);