OLD | NEW |
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 /* | 6 /* |
7 * ntmisc.c | 7 * ntmisc.c |
8 * | 8 * |
9 */ | 9 */ |
10 | 10 |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 } | 975 } |
976 PR_SetError(PR_UNKNOWN_ERROR, GetLastError()); | 976 PR_SetError(PR_UNKNOWN_ERROR, GetLastError()); |
977 } | 977 } |
978 return addr; | 978 return addr; |
979 } | 979 } |
980 | 980 |
981 PRStatus _MD_MemUnmap(void *addr, PRUint32 len) | 981 PRStatus _MD_MemUnmap(void *addr, PRUint32 len) |
982 { | 982 { |
983 if (UnmapViewOfFile(addr)) { | 983 if (UnmapViewOfFile(addr)) { |
984 return PR_SUCCESS; | 984 return PR_SUCCESS; |
985 } else { | |
986 PR_SetError(PR_UNKNOWN_ERROR, GetLastError()); | |
987 return PR_FAILURE; | |
988 } | 985 } |
| 986 _PR_MD_MAP_DEFAULT_ERROR(GetLastError()); |
| 987 return PR_FAILURE; |
989 } | 988 } |
990 | 989 |
991 PRStatus _MD_CloseFileMap(PRFileMap *fmap) | 990 PRStatus _MD_CloseFileMap(PRFileMap *fmap) |
992 { | 991 { |
993 CloseHandle(fmap->md.hFileMap); | 992 CloseHandle(fmap->md.hFileMap); |
994 PR_DELETE(fmap); | 993 PR_DELETE(fmap); |
995 return PR_SUCCESS; | 994 return PR_SUCCESS; |
996 } | 995 } |
997 | 996 |
| 997 PRStatus _MD_SyncMemMap( |
| 998 PRFileDesc *fd, |
| 999 void *addr, |
| 1000 PRUint32 len) |
| 1001 { |
| 1002 PROsfd osfd = fd->secret->md.osfd; |
| 1003 |
| 1004 /* The FlushViewOfFile page on MSDN says: |
| 1005 * To flush all the dirty pages plus the metadata for the file and |
| 1006 * ensure that they are physically written to disk, call |
| 1007 * FlushViewOfFile and then call the FlushFileBuffers function. |
| 1008 */ |
| 1009 if (FlushViewOfFile(addr, len) && FlushFileBuffers((HANDLE) osfd)) { |
| 1010 return PR_SUCCESS; |
| 1011 } |
| 1012 _PR_MD_MAP_DEFAULT_ERROR(GetLastError()); |
| 1013 return PR_FAILURE; |
| 1014 } |
| 1015 |
998 /* | 1016 /* |
999 *********************************************************************** | 1017 *********************************************************************** |
1000 * | 1018 * |
1001 * Atomic increment and decrement operations for x86 processors | 1019 * Atomic increment and decrement operations for x86 processors |
1002 * | 1020 * |
1003 * We don't use InterlockedIncrement and InterlockedDecrement | 1021 * We don't use InterlockedIncrement and InterlockedDecrement |
1004 * because on NT 3.51 and Win95, they return a number with | 1022 * because on NT 3.51 and Win95, they return a number with |
1005 * the same sign as the incremented/decremented result, rather | 1023 * the same sign as the incremented/decremented result, rather |
1006 * than the result itself. On NT 4.0 these functions do return | 1024 * than the result itself. On NT 4.0 these functions do return |
1007 * the incremented/decremented result. | 1025 * the incremented/decremented result. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 mov [ebx],eax | 1192 mov [ebx],eax |
1175 done: | 1193 done: |
1176 } | 1194 } |
1177 #endif /* __GNUC__ */ | 1195 #endif /* __GNUC__ */ |
1178 } | 1196 } |
1179 #pragma warning(default: 4035) | 1197 #pragma warning(default: 4035) |
1180 | 1198 |
1181 #endif /* _PR_HAVE_ATOMIC_CAS */ | 1199 #endif /* _PR_HAVE_ATOMIC_CAS */ |
1182 | 1200 |
1183 #endif /* x86 processors */ | 1201 #endif /* x86 processors */ |
OLD | NEW |