mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
parent
8313cc6752
commit
12dc1adf66
@ -166,9 +166,9 @@ s32 PS4_SYSV_ABI open(const char* raw_path, s32 flags, u16 mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e != 0) {
|
if (e != 0) {
|
||||||
// IOFile code uses platform specific errnos. Use POSIX_EIO for now
|
// IOFile code uses platform specific errnos, they must be converted to POSIX errnos.
|
||||||
h->DeleteHandle(handle);
|
h->DeleteHandle(handle);
|
||||||
*__Error() = POSIX_EIO;
|
SetPosixErrno(e);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -375,8 +375,8 @@ s64 PS4_SYSV_ABI posix_lseek(s32 fd, s64 offset, s32 whence) {
|
|||||||
|
|
||||||
if (!file->f.Seek(offset, origin)) {
|
if (!file->f.Seek(offset, origin)) {
|
||||||
if (errno != 0) {
|
if (errno != 0) {
|
||||||
// Seek failed in platform-specific code. Use POSIX_EIO for now.
|
// Seek failed in platform-specific code, errno needs to be converted.
|
||||||
*__Error() = POSIX_EIO;
|
SetPosixErrno(errno);
|
||||||
} else {
|
} else {
|
||||||
// Seek failed because offset is beyond the end of the file.
|
// Seek failed because offset is beyond the end of the file.
|
||||||
*__Error() = POSIX_ENXIO;
|
*__Error() = POSIX_ENXIO;
|
||||||
@ -386,8 +386,8 @@ s64 PS4_SYSV_ABI posix_lseek(s32 fd, s64 offset, s32 whence) {
|
|||||||
|
|
||||||
s64 result = file->f.Tell();
|
s64 result = file->f.Tell();
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
// Tell failed in platform-specific code. Use POSIX_EIO for now.
|
// Tell failed in platform-specific code, errno needs to be converted.
|
||||||
*__Error() = POSIX_EIO;
|
SetPosixErrno(errno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -84,6 +84,18 @@ int ErrnoToSceKernelError(int error) {
|
|||||||
return error + ORBIS_KERNEL_ERROR_UNKNOWN;
|
return error + ORBIS_KERNEL_ERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetPosixErrno(int e) {
|
||||||
|
// Some error numbers are different between supported OSes
|
||||||
|
switch (e) {
|
||||||
|
case ENOENT:
|
||||||
|
g_posix_errno = POSIX_ENOENT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
UNREACHABLE_MSG("errno = {}", e);
|
||||||
|
g_posix_errno = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static uint64_t g_mspace_atomic_id_mask = 0;
|
static uint64_t g_mspace_atomic_id_mask = 0;
|
||||||
static uint64_t g_mstate_table[64] = {0};
|
static uint64_t g_mstate_table[64] = {0};
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ namespace Libraries::Kernel {
|
|||||||
|
|
||||||
void ErrSceToPosix(int result);
|
void ErrSceToPosix(int result);
|
||||||
int ErrnoToSceKernelError(int e);
|
int ErrnoToSceKernelError(int e);
|
||||||
|
void SetPosixErrno(int e);
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
struct StringLiteral {
|
struct StringLiteral {
|
||||||
|
Loading…
Reference in New Issue
Block a user