Files
AnyPS5/core/libs/tests/GuestExecvp.cpp
T
Get-fix d686f7057c fix(libkernel): export execvp
VLC (PPSA85300) imports execvp (0NJDcQ2B8vE) from libkernel and fails
to load because no library exports it. Replacing the process image is
not supported, so it throws if called, like sceSystemServiceLoadExec
does for executable replacement. VLC itself cannot reach the call: its
fork and vfork fail with ENOSYS, so the child that would call execvp is
never created.
2026-10-10 19:12:49 +03:00

24 lines
865 B
C++

#include "prx/libc/include/general/VabiMacros.hpp"
#include <cstdlib>
#include <stdexcept>
#include <string>
extern "C" int APS5_VABI execvp_nid_postfix(const char*, char* const*);
static void Require(bool value) { if (!value) std::abort(); }
static bool ReportsNotImplemented(const char* file, char* const* arguments) {
try {
execvp_nid_postfix(file, arguments);
} catch (const std::runtime_error& error) {
return std::string(error.what()) == "execvp: executable replacement not implemented";
}
return false;
}
int main() {
char shell[] = "sh";
char option[] = "-c";
char command[] = "exit 0";
char* arguments[] = {shell, option, command, nullptr};
Require(ReportsNotImplemented("sh", arguments));
Require(ReportsNotImplemented("/bin/sh", arguments));
Require(ReportsNotImplemented(nullptr, nullptr));
}