0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 10:08:56 +02:00

ircd::fs: Add sync()/syncfs().

This commit is contained in:
Jason Volk 2018-12-12 10:55:56 -08:00
parent c156266bd8
commit b80735c575
2 changed files with 12 additions and 0 deletions

View file

@ -17,6 +17,7 @@ namespace ircd::fs
void fdsync(const fd &, const fsync_opts & = fsync_opts_default);
void fsync(const fd &, const fsync_opts & = fsync_opts_default);
void sync(const fd &, const fsync_opts & = fsync_opts_default);
}
/// Options for a write operation

View file

@ -518,6 +518,17 @@ ircd::fs::stdin::tty::write(const string_view &buf)
ircd::fs::fsync_opts
const ircd::fs::fsync_opts_default;
void
ircd::fs::sync(const fd &fd,
const fsync_opts &opts)
{
#ifdef __linux__
syscall(::syncfs, fd);
#else
syscall(::sync);
#endif
}
void
ircd::fs::fsync(const fd &fd,
const fsync_opts &opts)