/* * fs.fsync */ static int fs_fsync(lua_State* L) { FSR__SETUP int fd = luaL_checkint(L, 1); FSR__SET_OPT_CB(2, on_fs_callback) uv_fs_fsync(loop, req, fd, cb); FSR__TEARDOWN }
static void fdatasync_cb(uv_fs_t* req) { int r; ASSERT(req == &fdatasync_req); ASSERT(req->fs_type == UV_FS_FDATASYNC); ASSERT(req->result != -1); fdatasync_cb_count++; uv_fs_req_cleanup(req); r = uv_fs_fsync(loop, &fsync_req, open_req1.result, fsync_cb); }
static int lluv_file_sync(lua_State *L){ const char *path = NULL; lluv_file_t *f = lluv_check_file(L, 1, LLUV_FLAG_OPEN); lluv_loop_t *loop = f->loop; int argc = 1; LLUV_PRE_FILE(); lua_pushvalue(L, 1); req->file_ref = luaL_ref(L, LLUV_LUA_REGISTRY); err = uv_fs_fsync(loop->handle, &req->req, f->handle, cb); LLUV_POST_FILE(); }
/* Flushes the file handle. */ static void flush(MVMThreadContext *tc, MVMOSHandle *h){ MVMIOFileData *data = (MVMIOFileData *)h->body.data; uv_fs_t req; if (uv_fs_fsync(tc->loop, &req, data->fd, NULL) < 0 ) MVM_exception_throw_adhoc(tc, "Failed to flush filehandle: %s", uv_strerror(req.result)); }