AuroraRuntime/Include/Aurora/Process/ProcessEnvironment.hpp
Jamie Reece Wilson bdec6ff8ba [+] AuProcess::EnvironmentGetAll
[+] AuProcess::EnvironmentGetOne
[+] AuProcess::EnvironmentSetOne
[+] AuProcess::EnvironmentRemoveOne
[+] AuProcess::EnvironmentRemoveMany
[+] AuProcess::EnvironmentSetMany
[+] AuProcess::GetProcessStartupTimeNS
[+] AuProcess::GetProcessStartupTimeMS
[*] Note WakeOnAddress on all platforms
[*] Updated READMEs
2023-07-10 17:00:42 +01:00

38 lines
2.5 KiB
C++

/***
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: ProcessEnvironment.hpp
Date: 2023-7-10
Author: Reece
Note: I can't stand environment variables.
They're leftover POSIX shitstains used for configuration during process initialization of yesteryear (muh 'stdio/out ipc all the tiny things to build big things' model of computer operating systems).
The underlying environ block as described by the POSIX specifications is inherently thread unsafe, and hasn't carried itself into the modern era of computing past its' usage for shell $%PATH$% expansion...
Well, maybe there's software in the UNIX ecosystem glued together with XDG_HOPES_AND_DREAMS. I try not to think about those.
Well, maybe I'm forgetting the primary user of env-vars... JAVA_HOME!!! I suppose we can't forget about those few Java programs that don't ship the JRE & have startup.[sh/bat] scripts.
Alternatives:
* Win32 users are better served by the Windows registry
* Linux drivers have module_param to avoid early file io
* NT drivers can query the registry via RtlXXXXX APIs
* Userland IPC identification between child processes can be served by AuCmdLine
* Unix services are a mess of non-standard configuration files
Depending on the use case and OS, early application configuration on modern Unix (^) will differ
^: IE: A MacOS application package, a Linux server program with nonstandard configs+yamls, or BSD systems with xml interfaces will all want different IO
* Sqlite for large application configuration stores
Warning:
Aurora Runtime, in a bid to support environment variables properly in userland (ie: not emulating the api with no real effects in real-time), does not buffer the block
Other code in a UNIX process can bypass the mutex required for that respective platform
***/
#pragma once
namespace Aurora::Process
{
AUKN_SYM AuList<AuPair<AuString, AuString>> EnvironmentGetAll();
AUKN_SYM AuOptional<AuString> EnvironmentGetOne(const AuString &key);
AUKN_SYM bool EnvironmentSetOne(const AuString &key, const AuString &value);
AUKN_SYM bool EnvironmentRemoveOne(const AuString &key);
AUKN_SYM bool EnvironmentRemoveMany(const AuList<AuString> &list);
AUKN_SYM bool EnvironmentSetMany(const AuList<AuPair<AuString, AuString>> &list);
}