[pve-devel] [PATCH common] Tools: add fsync sycall

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jan 30 17:17:14 CET 2019


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/Syscall.pm | 1 +
 src/PVE/Tools.pm   | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/src/PVE/Syscall.pm b/src/PVE/Syscall.pm
index 87db66a..0f50c63 100644
--- a/src/PVE/Syscall.pm
+++ b/src/PVE/Syscall.pm
@@ -8,6 +8,7 @@ BEGIN {
 	unshare => &SYS_unshare,
 	setns => &SYS_setns,
 	syncfs => &SYS_syncfs,
+	fsync => &SYS_fsync,
 	openat => &SYS_openat,
 	close => &SYS_close,
 	mkdirat => &SYS_mkdirat,
diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index accf653..cd236b5 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -1399,6 +1399,11 @@ sub syncfs($) {
     return 0 == syscall(PVE::Syscall::syncfs, $fileno);
 }
 
+sub fsync($) {
+    my ($fileno) = @_;
+    return 0 == syscall(PVE::Syscall::fsync, $fileno);
+}
+
 sub sync_mountpoint {
     my ($path) = @_;
     sysopen my $fd, $path, O_PATH or die "failed to open $path: $!\n";
-- 
2.20.1





More information about the pve-devel mailing list