[llvm] [Cygwin] Cygwin general (PR #74944)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 9 10:19:40 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-platform-windows
@llvm/pr-subscribers-llvm-support
Author: εΎζζ Xu Chiheng (xu-chiheng)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/74944.diff
2 Files Affected:
- (modified) llvm/lib/Support/Process.cpp (+19)
- (modified) llvm/lib/Support/Windows/Process.inc (-13)
``````````diff
diff --git a/llvm/lib/Support/Process.cpp b/llvm/lib/Support/Process.cpp
index 30c64d3ed9ed1..6d4a7275f5fa6 100644
--- a/llvm/lib/Support/Process.cpp
+++ b/llvm/lib/Support/Process.cpp
@@ -23,6 +23,10 @@
#include <optional>
#include <stdlib.h> // for _Exit
+#if defined(_WIN32) || defined(__CYGWIN__)
+#include <windows.h>
+#endif
+
using namespace llvm;
using namespace sys;
@@ -102,6 +106,21 @@ bool Process::AreCoreFilesPrevented() { return coreFilesPrevented; }
::exit(RetCode);
}
+#if defined(_WIN32) || defined(__CYGWIN__)
+// This function retrieves the page size using GetNativeSystemInfo() and is
+// present solely so it can be called once to initialize the self_process member
+// below.
+static unsigned computePageSize() {
+ // GetNativeSystemInfo() provides the physical page size which may differ
+ // from GetSystemInfo() in 32-bit applications running under WOW64.
+ SYSTEM_INFO info;
+ GetNativeSystemInfo(&info);
+ // FIXME: FileOffset in MapViewOfFile() should be aligned to not dwPageSize,
+ // but dwAllocationGranularity.
+ return static_cast<unsigned>(info.dwPageSize);
+}
+#endif
+
// Include the platform-specific parts of this class.
#ifdef LLVM_ON_UNIX
#include "Unix/Process.inc"
diff --git a/llvm/lib/Support/Windows/Process.inc b/llvm/lib/Support/Windows/Process.inc
index a54c06d46870b..9addfa6ec805e 100644
--- a/llvm/lib/Support/Windows/Process.inc
+++ b/llvm/lib/Support/Windows/Process.inc
@@ -50,19 +50,6 @@ Process::Pid Process::getProcessId() {
return Pid(::GetCurrentProcessId());
}
-// This function retrieves the page size using GetNativeSystemInfo() and is
-// present solely so it can be called once to initialize the self_process member
-// below.
-static unsigned computePageSize() {
- // GetNativeSystemInfo() provides the physical page size which may differ
- // from GetSystemInfo() in 32-bit applications running under WOW64.
- SYSTEM_INFO info;
- GetNativeSystemInfo(&info);
- // FIXME: FileOffset in MapViewOfFile() should be aligned to not dwPageSize,
- // but dwAllocationGranularity.
- return static_cast<unsigned>(info.dwPageSize);
-}
-
Expected<unsigned> Process::getPageSize() {
static unsigned Ret = computePageSize();
return Ret;
``````````
</details>
https://github.com/llvm/llvm-project/pull/74944
More information about the llvm-commits
mailing list