| 85 | } |
| 86 | |
| 87 | virtual Status Sync() { |
| 88 | #if __linux__ |
| 89 | // Ensure new files referred to by the manifest are in the filesystem. |
| 90 | if (fflush_unlocked(file_) != 0 || fdatasync(fileno(file_)) != 0) { |
| 91 | return IOError(filename_, errno); |
| 92 | } |
| 93 | #else |
| 94 | // Ensure new files referred to by the manifest are in the filesystem. |
| 95 | if (fflush(file_) != 0 || fsync(fileno(file_)) != 0) { |
| 96 | return IOError(filename_, errno); |
| 97 | } |
| 98 | #endif |
| 99 | return Status::OK(); |
| 100 | } |
| 101 | |
| 102 | private: |
| 103 | std::string filename_; |