| 222 | } |
| 223 | |
| 224 | bool MemoryFile::msync(SyncFlag syncFlag) { |
| 225 | if (m_readOnly) { |
| 226 | // there's no point in msync() readonly memory |
| 227 | return true; |
| 228 | } |
| 229 | if (m_ptr) { |
| 230 | auto ret = ::msync(m_ptr, m_size, syncFlag ? MS_SYNC : MS_ASYNC); |
| 231 | if (ret == 0) { |
| 232 | return true; |
| 233 | } |
| 234 | MMKVError("fail to msync [%s], %s", m_diskFile.m_path.c_str(), strerror(errno)); |
| 235 | } |
| 236 | return false; |
| 237 | } |
| 238 | |
| 239 | bool MemoryFile::mmapOrCleanup(FileLock *fileLock) { |
| 240 | auto oldPtr = m_ptr; |
no outgoing calls
no test coverage detected