From 648aebb8b6dcf28c85477398572e5552062ceb18 Mon Sep 17 00:00:00 2001 From: Seth Jackson Date: Sat, 17 Oct 2015 01:21:50 +0100 Subject: Port fsync() to libuv. --- src/nvim/os/fs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/nvim/os') 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. -- cgit