Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions core/libs/prx/libSceSystemService/Export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,7 @@ extern "C" {

int APS5_VABI sceSystemServiceLoadExec(const char* path, const char* const* arguments) {
if (!path || !*path) return SYSTEM_SERVICE_ERROR_PARAMETER;
if (std::strcmp(path, "exit") == 0) {
LibcRunShutdown_nid_postfix();
std::exit(0);
}
if (std::strcmp(path, "exit") == 0) LibcExit_nid_no_patch(0);
auto launch = PrepareLaunch(path, arguments);
LibcRunShutdown_nid_postfix();
std::fflush(nullptr);
Expand Down
6 changes: 5 additions & 1 deletion core/libs/tests/GuestSystemExit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@
#include <unistd.h>
#endif
extern "C" int APS5_VABI sceSystemServiceLoadExec(const char*, const char* const*);
extern "C" int APS5_VABI __cxa_atexit_nid_postfix(void (APS5_VABI *func)(void*), void* arg, void* dsoHandle);
extern "C" void APS5_VABI _Exit_nid_postfix(int);
extern "C" void APS5_VABI catchReturnFromMain_nid_postfix(int);
using GuestQuickExitCallback = void (APS5_VABI*)();
extern "C" int APS5_VABI at_quick_exit_nid_postfix(GuestQuickExitCallback);
extern "C" void APS5_VABI quick_exit_nid_postfix(int);
namespace {
bool cleaned = false;
bool finalized = false;
void Cleanup() { cleaned = true; }
void APS5_VABI Finalize(void*) { finalized = true; }
void VerifyExit() {
if (!cleaned) std::_Exit(1);
if (!cleaned || !finalized) std::_Exit(1);
std::puts("Guest shutdown and atexit completed");
}
int quickOrder = 0;
Expand Down Expand Up @@ -164,6 +167,7 @@ int main(int argc, char** argv) {
}
if (argc > 1) {
LibcRegisterShutdown_nid_postfix(Cleanup);
Require(__cxa_atexit_nid_postfix(Finalize, nullptr, nullptr) == 0);
Require(std::atexit(VerifyExit) == 0);
sceSystemServiceLoadExec("exit", nullptr);
return 2;
Expand Down
Loading