From b047cd79edb34ed6716e6748eb1e725ab97fb4dc Mon Sep 17 00:00:00 2001 From: Ariel Abreu Date: Sat, 25 Apr 2020 16:07:29 -0400 Subject: [PATCH] Implement `F_FULLFSYNC` using Linux's `fsync` It's okay because Linux's `fsync` guarantees the same that macOS's `F_FULLFSYNC` does: the data will be written to the disk and, if necessary, it will wait for the disk cache to be flushed --- src/kernel/emulation/linux/fcntl/fcntl.c | 6 ++++++ src/kernel/emulation/linux/fcntl/fcntl.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/kernel/emulation/linux/fcntl/fcntl.c b/src/kernel/emulation/linux/fcntl/fcntl.c index 17bf33ad2..186e1ec9d 100644 --- a/src/kernel/emulation/linux/fcntl/fcntl.c +++ b/src/kernel/emulation/linux/fcntl/fcntl.c @@ -76,6 +76,12 @@ long sys_fcntl_nocancel(int fd, int cmd, long arg) case F_GETLK: // TODO return 0; + case F_FULLFSYNC: { + ret = LINUX_SYSCALL1(__NR_fsync, fd); + if (ret < 0) + ret = errno_linux_to_bsd(ret); + return 0; + }; // TODO: implement remaining commands default: return -EINVAL; diff --git a/src/kernel/emulation/linux/fcntl/fcntl.h b/src/kernel/emulation/linux/fcntl/fcntl.h index 25decef9f..c93068dae 100644 --- a/src/kernel/emulation/linux/fcntl/fcntl.h +++ b/src/kernel/emulation/linux/fcntl/fcntl.h @@ -44,6 +44,7 @@ enum { F_RDADVISE, F_RDAHEAD, F_GETPATH = 50, + F_FULLFSYNC = 51, F_CHECK_LV = 98, }; -- 2.54.0