mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::fs: Add sync()/syncfs().
This commit is contained in:
parent
c156266bd8
commit
b80735c575
2 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
|
|
11
ircd/fs.cc
11
ircd/fs.cc
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue