FileFd::sync_barrier uses F_BARRIERFSYNC on darwin
This commit is contained in:
parent
80fc0346e8
commit
a0dd1e1a07
@ -635,6 +635,16 @@ Status FileFd::sync() {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status FileFd::sync_barrier() {
|
||||
CHECK(!empty());
|
||||
#if TD_DARWIN && defined(F_BARRIERFSYNC)
|
||||
if (detail::skip_eintr([&] { return fcntl(get_native_fd().fd(), F_BARRIERFSYNC); }) == -1) {
|
||||
return Status::OK();
|
||||
}
|
||||
#endif
|
||||
return sync();
|
||||
}
|
||||
|
||||
Status FileFd::seek(int64 position) {
|
||||
CHECK(!empty());
|
||||
#if TD_PORT_POSIX
|
||||
|
@ -62,6 +62,7 @@ class FileFd {
|
||||
Result<Stat> stat() const;
|
||||
|
||||
Status sync() TD_WARN_UNUSED_RESULT;
|
||||
Status sync_barrier() TD_WARN_UNUSED_RESULT;
|
||||
|
||||
Status seek(int64 position) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user