8000 modify msync code so that only base address is page-aligned (#6585) · soualid/arangodb@5a13afd · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a13afd

Browse files
authored
modify msync code so that only base address is page-aligned (arangodb#6585)
according to man msync, there is no need for the end address to be page-aligned also use uintptr_t consistently instead of intptr_t
1 parent 4444832 commit 5a13afd

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/Basics/memory-map.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,12 @@ int TRI_MMFileUnlock(void* memoryAddress, size_t numOfBytes);
106106

107107
static inline int TRI_MSync(int fd, char const* begin, char const* end) {
108108
size_t pageSize = arangodb::PageSizeFeature::getPageSize();
109-
uintptr_t p = (intptr_t)begin;
110-
uintptr_t q = (intptr_t)end;
111-
uintptr_t g = (intptr_t)pageSize;
109+
uintptr_t p = (uintptr_t)begin;
110+
uintptr_t g = (uintptr_t)pageSize;
112111

113112
char* b = (char*)((p / g) * g);
114-
char* e = (char*)(((q + g - 1) / g) * g);
115113

116-
return TRI_FlushMMFile(fd, b, e - b, MS_SYNC);
114+
return TRI_FlushMMFile(fd, b, end - b, MS_SYNC);
117115
}
118116

119117
#endif

0 commit comments

Comments
 (0)
0