diff options
Diffstat (limited to 'chromium/third_party/nss/nspr/pr/src/md/windows/ntmisc.c')
-rw-r--r-- | chromium/third_party/nss/nspr/pr/src/md/windows/ntmisc.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/chromium/third_party/nss/nspr/pr/src/md/windows/ntmisc.c b/chromium/third_party/nss/nspr/pr/src/md/windows/ntmisc.c index e23f6725e97..12f8c1df773 100644 --- a/chromium/third_party/nss/nspr/pr/src/md/windows/ntmisc.c +++ b/chromium/third_party/nss/nspr/pr/src/md/windows/ntmisc.c @@ -982,10 +982,9 @@ PRStatus _MD_MemUnmap(void *addr, PRUint32 len) { if (UnmapViewOfFile(addr)) { return PR_SUCCESS; - } else { - PR_SetError(PR_UNKNOWN_ERROR, GetLastError()); - return PR_FAILURE; } + _PR_MD_MAP_DEFAULT_ERROR(GetLastError()); + return PR_FAILURE; } PRStatus _MD_CloseFileMap(PRFileMap *fmap) @@ -995,6 +994,25 @@ PRStatus _MD_CloseFileMap(PRFileMap *fmap) return PR_SUCCESS; } +PRStatus _MD_SyncMemMap( + PRFileDesc *fd, + void *addr, + PRUint32 len) +{ + PROsfd osfd = fd->secret->md.osfd; + + /* The FlushViewOfFile page on MSDN says: + * To flush all the dirty pages plus the metadata for the file and + * ensure that they are physically written to disk, call + * FlushViewOfFile and then call the FlushFileBuffers function. + */ + if (FlushViewOfFile(addr, len) && FlushFileBuffers((HANDLE) osfd)) { + return PR_SUCCESS; + } + _PR_MD_MAP_DEFAULT_ERROR(GetLastError()); + return PR_FAILURE; +} + /* *********************************************************************** * |