| 578 | |
| 579 | |
| 580 | __attribute__((constructor)) |
| 581 | static 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)) |
| 605 | static void OnUnload() |
nothing calls this directly
no test coverage detected