diff options
Diffstat (limited to 'llvm/lib/Support/Unix/Process.inc')
-rw-r--r-- | llvm/lib/Support/Unix/Process.inc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc index 7c834f97114..78c123493e1 100644 --- a/llvm/lib/Support/Unix/Process.inc +++ b/llvm/lib/Support/Unix/Process.inc @@ -69,7 +69,7 @@ static std::pair<std::chrono::microseconds, std::chrono::microseconds> getRUsage // On Cygwin, getpagesize() returns 64k(AllocationGranularity) and // offset in mmap(3) should be aligned to the AllocationGranularity. -unsigned Process::getPageSize() { +Expected<unsigned> Process::getPageSize() { #if defined(HAVE_GETPAGESIZE) static const int page_size = ::getpagesize(); #elif defined(HAVE_SYSCONF) @@ -77,6 +77,9 @@ unsigned Process::getPageSize() { #else #error Cannot get the page size on this machine #endif + if (page_size == -1) + return errorCodeToError(std::error_code(errno, std::generic_category())); + return static_cast<unsigned>(page_size); } |