MCPcopy Create free account
hub / github.com/boostorg/filesystem / full_sync

Function full_sync

src/operations.cpp:621–646  ·  view source on GitHub ↗

Flushes buffered data and attributes written to the file to permanent storage

Source from the content-addressed store, hash-verified

619
620//! Flushes buffered data and attributes written to the file to permanent storage
621inline int full_sync(int fd)
622{
623 while (true)
624 {
625#if defined(__APPLE__) && defined(__MACH__) && defined(F_FULLFSYNC)
626 // Mac OS does not flush data to physical storage with fsync()
627 int err = ::fcntl(fd, F_FULLFSYNC);
628#else
629 int err = ::fsync(fd);
630#endif
631 if (BOOST_UNLIKELY(err < 0))
632 {
633 err = errno;
634 // POSIX says fsync can return EINTR (https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html).
635 // fcntl(F_FULLFSYNC) isn't documented to return EINTR, but it doesn't hurt to check.
636 if (err == EINTR)
637 continue;
638
639 return err;
640 }
641
642 break;
643 }
644
645 return 0;
646}
647
648//! Flushes buffered data written to the file to permanent storage
649inline int data_sync(int fd)

Callers 2

data_syncFunction · 0.85
copy_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected