Merge pull request #3682 from zmeizy/claude/kernel-fsync-error-codes
fix(libkernel): return SCE error codes from sceKernelFsync
This commit is contained in:
commit
d2fa71b706
|
|
@ -731,11 +731,13 @@ int APS5_VABI sceKernelFstat(int d, FileStat* sb) {
|
|||
}
|
||||
|
||||
int APS5_VABI sceKernelFsync(int fd) {
|
||||
if (fd >= GuestSockets::FirstDescriptor) return SceErrorFromErrno(GuestSockets::IsOpen(fd) ? GUEST_EINVAL : GUEST_EBADF);
|
||||
#ifdef _WIN32
|
||||
return NativeSync(fd);
|
||||
if (NativeSync(fd) != 0) return SceErrorFromErrno(errno);
|
||||
#else
|
||||
return ::fsync(fd);
|
||||
if (::fsync(fd) != 0) return SceErrorFromErrno(errno);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceKernelFdatasync(int fd) {
|
||||
|
|
@ -1141,8 +1143,7 @@ int APS5_VABI futimes_nid_postfix(int d, const KernelTimeval* times) {
|
|||
}
|
||||
|
||||
int APS5_VABI fsync_nid_postfix(int fd) {
|
||||
if (sceKernelFsync(fd) != 0) return PosixFailure(errno);
|
||||
return 0;
|
||||
return PosixResult(sceKernelFsync(fd));
|
||||
}
|
||||
|
||||
int APS5_VABI fdatasync_nid_postfix(int fd) {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ int APS5_VABI sceKernelFutimes(int, const KernelTimeval*);
|
|||
int APS5_VABI socket_nid_postfix(int, int, int);
|
||||
int APS5_VABI sceKernelFsync(int);
|
||||
int APS5_VABI fdatasync_nid_postfix(int);
|
||||
int APS5_VABI fsync_nid_postfix(int);
|
||||
int APS5_VABI sceKernelFdatasync(int);
|
||||
int APS5_VABI sceKernelWriteThrottlingStatus(std::uint64_t*);
|
||||
int APS5_VABI sceKernelFtruncate(int, long long);
|
||||
|
|
@ -358,6 +359,8 @@ int main() {
|
|||
Require(futimes_nid_postfix(descriptor, nullptr) == -1 && *__error_nid_postfix() == 9);
|
||||
Require(fdatasync_nid_postfix(descriptor) == -1 && *__error_nid_postfix() == 9);
|
||||
Require(sceKernelFdatasync(descriptor) == static_cast<int>(0x80020009u));
|
||||
Require(fsync_nid_postfix(descriptor) == -1 && *__error_nid_postfix() == 9);
|
||||
Require(sceKernelFsync(descriptor) == static_cast<int>(0x80020009u));
|
||||
const int socket = socket_nid_postfix(2, 2, 0);
|
||||
Require(socket >= 0);
|
||||
Require(sceKernelFchmod(socket, 0600) == static_cast<int>(0x80020016u));
|
||||
|
|
@ -365,12 +368,17 @@ int main() {
|
|||
Require(futimes_nid_postfix(socket, nullptr) == -1 && *__error_nid_postfix() == 22);
|
||||
Require(fdatasync_nid_postfix(socket) == -1 && *__error_nid_postfix() == 22);
|
||||
Require(sceKernelFdatasync(socket) == static_cast<int>(0x80020016u));
|
||||
Require(fsync_nid_postfix(socket) == -1 && *__error_nid_postfix() == 22);
|
||||
Require(sceKernelFsync(socket) == static_cast<int>(0x80020016u));
|
||||
Require(close_nid_postfix(socket) == 0);
|
||||
Require(fchmod_nid_postfix(socket, 0600) == -1 && *__error_nid_postfix() == 9);
|
||||
Require(futimes_nid_postfix(socket, nullptr) == -1 && *__error_nid_postfix() == 9);
|
||||
Require(fdatasync_nid_postfix(socket) == -1 && *__error_nid_postfix() == 9);
|
||||
Require(sceKernelFdatasync(socket) == static_cast<int>(0x80020009u));
|
||||
Require(fsync_nid_postfix(socket) == -1 && *__error_nid_postfix() == 9);
|
||||
Require(sceKernelFsync(socket) == static_cast<int>(0x80020009u));
|
||||
Require(sceKernelFdatasync(0x7fffffff) == static_cast<int>(0x80020009u));
|
||||
Require(sceKernelFsync(0x7fffffff) == static_cast<int>(0x80020009u));
|
||||
Require(remove_nid_postfix(sized.string().c_str()) == 0);
|
||||
const auto present = root / "present.txt";
|
||||
const auto presentName = present.string();
|
||||
|
|
|
|||
Loading…
Reference in New Issue