Internal change
PiperOrigin-RevId: 522253757
This commit is contained in:
parent
0067a1b5c2
commit
56b3cd4350
|
@ -66,13 +66,13 @@ using ::absl::StatusCode;
|
||||||
// Gets the offset aligned to page size for mapping given files into memory by
|
// Gets the offset aligned to page size for mapping given files into memory by
|
||||||
// file descriptor correctly, as according to mmap(2), the offset used in mmap
|
// file descriptor correctly, as according to mmap(2), the offset used in mmap
|
||||||
// must be a multiple of sysconf(_SC_PAGE_SIZE).
|
// must be a multiple of sysconf(_SC_PAGE_SIZE).
|
||||||
int64 GetPageSizeAlignedOffset(int64 offset) {
|
int64_t GetPageSizeAlignedOffset(int64_t offset) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// mmap is not used on Windows
|
// mmap is not used on Windows
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
int64 aligned_offset = offset;
|
int64_t aligned_offset = offset;
|
||||||
int64 page_size = sysconf(_SC_PAGE_SIZE);
|
int64_t page_size = sysconf(_SC_PAGE_SIZE);
|
||||||
if (offset % page_size != 0) {
|
if (offset % page_size != 0) {
|
||||||
aligned_offset = offset / page_size * page_size;
|
aligned_offset = offset / page_size * page_size;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user