kernel: implement POSIX fsync through the shared file API

This commit is contained in:
nmzik committed 2026-10-18 20:15:53 +02:00
1 parent 831862a50b
commit 7675579e79
5 files changed
+56 -10

No files matched your search

+21
View File
@@ -1326,6 +1326,27 @@ int KYTY_SYSV_ABI KernelFtruncate(int d, int64_t length) {
return OK;
}
int KYTY_SYSV_ABI KernelFsync(int d) {
PRINT_NAME();
if (d < DESCRIPTOR_MIN) {
return KERNEL_ERROR_EBADF;
}
auto* file = g_files->GetFile(d);
if (file == nullptr || !file->opened) {
return KERNEL_ERROR_EBADF;
}
Common::LockGuard lock(file->mutex);
if (file->f.IsInvalid() || !file->f.Flush()) {
return KERNEL_ERROR_EIO;
}
LOGF("\tFsync: %s\n", Common::PathToString(file->real_name).c_str());
return OK;
}
int KYTY_SYSV_ABI KernelUnlink(const char* path) {
PRINT_NAME();