aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-01-01 12:13:40 -0500
committerJustin M. Keyes <justinkz@gmail.com>2016-01-01 12:13:40 -0500
commitdf4ac79761162313de4e27a265044125062013cf (patch)
treef29cc5366be73b1ec58e29e0cb50b407b27a1e8c /src/nvim/os
parenta79ebeeea469958a2f56096dcfc878da7cf790d6 (diff)
parent648aebb8b6dcf28c85477398572e5552062ceb18 (diff)
downloadrneovim-df4ac79761162313de4e27a265044125062013cf.tar.gz
rneovim-df4ac79761162313de4e27a265044125062013cf.tar.bz2
rneovim-df4ac79761162313de4e27a265044125062013cf.zip
Merge pull request #3911 from sethjackson/have-fsync-guard
os_fsync
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/fs.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index d59b66e773..1a4c3495f2 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -202,6 +202,19 @@ int os_open(const char* path, int flags, int mode)
return r;
}
+/// Flushes file modifications to disk.
+///
+/// @param fd the file descriptor of the file to flush to disk.
+///
+/// @return `0` on success, a libuv error code on failure.
+int os_fsync(int fd)
+{
+ uv_fs_t fsync_req;
+ int r = uv_fs_fsync(&fs_loop, &fsync_req, fd, NULL);
+ uv_fs_req_cleanup(&fsync_req);
+ return r;
+}
+
/// Get stat information for a file.
///
/// @return libuv return code.