mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 08:33:12 -05:00
AI-assisted: yes. Return AnyPS5 without reading the native machine name, hostname environment or network configuration. Preserve FreeBSD bounded-copy behavior, guest ENAMETOOLONG, null queries and success errno. The final tree passes a complete Windows Release build and guest_hostname/guest_errors repeated five times each on main 5edae3536. No new Linux or title test is claimed.
17 lines
540 B
C++
17 lines
540 B
C++
#include "prx/libc/include/general/VabiMacros.hpp"
|
|
#include <algorithm>
|
|
#include <cerrno>
|
|
#include <cstddef>
|
|
#include <cstring>
|
|
|
|
extern "C" int APS5_VABI gethostname_nid_postfix(char* name, std::size_t length) {
|
|
constexpr char hostname[] = "AnyPS5";
|
|
if (name == nullptr) return 0;
|
|
const int savedError = errno;
|
|
const auto count = std::min(length, sizeof(hostname));
|
|
if (count != 0) std::memcpy(name, hostname, count);
|
|
if (length < sizeof(hostname)) { errno = 63; return -1; }
|
|
errno = savedError;
|
|
return 0;
|
|
}
|