mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-23 00:53:02 -05:00
fopen left the host's errno in place when the host open failed, so on Linux a symlink loop reached the title as 40 and an over-long name as 36, which are EMSGSIZE and EINPROGRESS on FreeBSD. GuestErrnoFromHost_nid_no_patch maps the host value to FreeBSD 11.4's: 1 to 34 are shared except EAGAIN (35), and ELOOP, ENAMETOOLONG, ENOTEMPTY, EDQUOT, EOVERFLOW and EDEADLK get their FreeBSD numbers; anything else is EIO.
36 lines
887 B
C++
36 lines
887 B
C++
#include "prx/libc/include/HostErrno.hpp"
|
|
|
|
#include <cerrno>
|
|
|
|
namespace {
|
|
|
|
constexpr int GuestEio = 5;
|
|
constexpr int GuestEdeadlk = 11;
|
|
constexpr int GuestEagain = 35;
|
|
constexpr int GuestEloop = 62;
|
|
constexpr int GuestEnametoolong = 63;
|
|
constexpr int GuestEnotempty = 66;
|
|
constexpr int GuestEdquot = 69;
|
|
constexpr int GuestEoverflow = 84;
|
|
|
|
}
|
|
|
|
extern "C" int GuestErrnoFromHost_nid_no_patch(int error) {
|
|
if (error == EAGAIN) return GuestEagain;
|
|
#ifdef EDEADLK
|
|
if (error == EDEADLK) return GuestEdeadlk;
|
|
#endif
|
|
if (error == ENAMETOOLONG) return GuestEnametoolong;
|
|
if (error == ENOTEMPTY) return GuestEnotempty;
|
|
#ifdef ELOOP
|
|
if (error == ELOOP) return GuestEloop;
|
|
#endif
|
|
#ifdef EDQUOT
|
|
if (error == EDQUOT) return GuestEdquot;
|
|
#endif
|
|
#ifdef EOVERFLOW
|
|
if (error == EOVERFLOW) return GuestEoverflow;
|
|
#endif
|
|
return error > 0 && error <= 34 ? error : GuestEio;
|
|
}
|