From f1086ea04dff2ca01b601cc3e9c93bb8bad41882 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Fri, 30 Sep 2016 20:16:01 +0000 Subject: [PATCH] Retire NEED_DEV_ZERO_FOR_MMAP. It should be needed only on outdated systems. It wasn't even hooked up in cmake, so problems on such systems would be visible with 3.9 release already. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282924 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Config/config.h.cmake | 4 ---- lib/Support/Unix/Memory.inc | 16 ---------------- 2 files changed, 20 deletions(-) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index cc049ca713f..e0f68afa38c 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -450,10 +450,6 @@ /* Define to the extension used for shared libraries, say, ".so". */ #cmakedefine LTDL_SHLIB_EXT "${LTDL_SHLIB_EXT}" -/* Define if /dev/zero should be used when mapping RWX memory, or undefine if - its not necessary */ -#undef NEED_DEV_ZERO_FOR_MMAP - /* Define to the address where bug reports for this package should be sent. */ #cmakedefine PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}" diff --git a/lib/Support/Unix/Memory.inc b/lib/Support/Unix/Memory.inc index f3463e58173..88b2a28c3a1 100644 --- a/lib/Support/Unix/Memory.inc +++ b/lib/Support/Unix/Memory.inc @@ -91,14 +91,6 @@ Memory::allocateMappedMemory(size_t NumBytes, const size_t NumPages = (NumBytes+PageSize-1)/PageSize; int fd = -1; -#ifdef NEED_DEV_ZERO_FOR_MMAP - static int zero_fd = open("/dev/zero", O_RDWR); - if (zero_fd == -1) { - EC = std::error_code(errno, std::generic_category()); - return MemoryBlock(); - } - fd = zero_fd; -#endif int MMFlags = MAP_PRIVATE | #ifdef HAVE_MMAP_ANONYMOUS @@ -185,14 +177,6 @@ Memory::AllocateRWX(size_t NumBytes, const MemoryBlock* NearBlock, size_t NumPages = (NumBytes+PageSize-1)/PageSize; int fd = -1; -#ifdef NEED_DEV_ZERO_FOR_MMAP - static int zero_fd = open("/dev/zero", O_RDWR); - if (zero_fd == -1) { - MakeErrMsg(ErrMsg, "Can't open /dev/zero device"); - return MemoryBlock(); - } - fd = zero_fd; -#endif int flags = MAP_PRIVATE | #ifdef HAVE_MMAP_ANONYMOUS -- 2.50.1