MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / OnLoad

Function OnLoad

src/platform/linux/init.cpp:580–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578
579
580__attribute__((constructor))
581static void OnLoad()
582{
583 std::string proc = GetProcessName();
584 if (proc != "steam" && !SteamclientMapped())
585 return;
586
587 // Clean ourselves from LD_PRELOAD so child processes don't inherit us
588 CleanLdPreload();
589
590 EnsureLogInit();
591 DebugLog("[CR] OnLoad: target process (steam), spawning deferred init thread\n");
592 Log::Info("cloud_redirect.so active in process 'steam' (pid=%d)", getpid());
593
594 bool expected = false;
595 if (g_hookAttempted.compare_exchange_strong(expected, true))
596 {
597 if (pthread_create(&g_initThread, nullptr, DeferredInitThread, nullptr) != 0) {
598 DebugLog("[CR] OnLoad: FAILED to create init thread\n");
599 g_initThreadDone.store(true, std::memory_order_release);
600 }
601 }
602}
603
604__attribute__((destructor))
605static void OnUnload()

Callers

nothing calls this directly

Calls 5

GetProcessNameFunction · 0.85
SteamclientMappedFunction · 0.85
CleanLdPreloadFunction · 0.85
EnsureLogInitFunction · 0.85
DebugLogFunction · 0.85

Tested by

no test coverage detected