sys_fs_fsync implemented

sys_fs_fdatasync implemented as equal function
This commit is contained in:
Nekotekina 2017-04-24 18:43:27 +03:00
parent 19fd8c109e
commit 256dfc5729
6 changed files with 76 additions and 21 deletions

View file

@ -156,6 +156,16 @@ namespace fs
{
}
stat_t file_base::stat()
{
fmt::throw_exception("fs::file::stat() not supported for %s", typeid(*this).name());
}
void file_base::sync()
{
// Do notning
}
dir_base::~dir_base()
{
}
@ -745,6 +755,11 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
return info;
}
void sync() override
{
verify("file::sync" HERE), FlushFileBuffers(m_handle);
}
bool trunc(u64 length) override
{
LARGE_INTEGER old, pos;
@ -870,6 +885,11 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
return info;
}
void sync() override
{
verify("file::sync" HERE), ::fsync(m_fd) == 0;
}
bool trunc(u64 length) override
{
if (::ftruncate(m_fd, length) != 0)
@ -945,11 +965,6 @@ fs::file::file(const void* ptr, std::size_t size)
{
}
fs::stat_t stat() override
{
fmt::raw_error("fs::file::memory_stream::stat(): not supported");
}
bool trunc(u64 length) override
{
return false;