[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] pdumper 131d65b 2/6: Use mmap retry on Cygwin too
From: |
Daniel Colascione |
Subject: |
[Emacs-diffs] pdumper 131d65b 2/6: Use mmap retry on Cygwin too |
Date: |
Mon, 19 Feb 2018 12:02:50 -0500 (EST) |
branch: pdumper
commit 131d65b3e8b0d32ffd685249d58fd656cdbc2080
Author: Daniel Colascione <address@hidden>
Commit: Daniel Colascione <address@hidden>
Use mmap retry on Cygwin too
---
src/pdumper.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/pdumper.c b/src/pdumper.c
index dfcf33e..9a0770d 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -172,7 +172,7 @@ ptrdiff_t_to_dump_off (ptrdiff_t value)
static int
dump_get_page_size (void)
{
-#ifdef WINDOWSNT
+#if defined (WINDOWSNT) || defined (CYGWIN)
return 64 * 1024; /* Worst-case allocation granularity. */
#else
return getpagesize ();
@@ -4502,6 +4502,16 @@ dump_mmap_release_vm (struct dump_memory_map *map)
}
static bool
+needs_mmap_retry_p (void)
+{
+#if defined (CYGWIN) || VM_SUPPORTED == VM_MS_WINDOWS
+ return true;
+#else
+ return false;
+#endif
+}
+
+static bool
dump_mmap_contiguous_vm (
struct dump_memory_map *maps,
int nr_maps,
@@ -4510,12 +4520,13 @@ dump_mmap_contiguous_vm (
bool ret = false;
void *resv = NULL;
bool retry = false;
+ const bool need_retry = needs_mmap_retry_p ();
do
{
if (retry)
{
- eassert (VM_SUPPORTED == VM_MS_WINDOWS);
+ eassert (need_retry);
retry = false;
for (int i = 0; i < nr_maps; ++i)
dump_mmap_release (&maps[i]);
@@ -4530,7 +4541,7 @@ dump_mmap_contiguous_vm (
char *mem = resv;
- if (VM_SUPPORTED == VM_MS_WINDOWS)
+ if (need_retry)
{
/* Windows lacks atomic mapping replace; need to release the
reservation so we can allocate within it. Will retry the
@@ -4555,9 +4566,13 @@ dump_mmap_contiguous_vm (
map->mapping = dump_map_file (
mem, spec.fd, spec.offset, spec.size, spec.protection);
mem += spec.size;
- if (VM_SUPPORTED == VM_MS_WINDOWS &&
+ if (need_retry &&
map->mapping == NULL &&
- errno == EBUSY)
+ (errno == EBUSY
+#ifdef CYGWIN
+ || errno == EINVAL
+#endif
+ ))
{
retry = true;
continue;
@@ -4578,7 +4593,7 @@ dump_mmap_contiguous_vm (
{
for (int i = 0; i < nr_maps; ++i)
{
- if (VM_SUPPORTED == VM_MS_WINDOWS)
+ if (need_retry)
dump_mmap_reset (&maps[i]);
else
dump_mmap_release (&maps[i]);
- [Emacs-diffs] pdumper updated (4eb06e3 -> b7da1a5), Daniel Colascione, 2018/02/19
- [Emacs-diffs] pdumper 131d65b 2/6: Use mmap retry on Cygwin too,
Daniel Colascione <=
- [Emacs-diffs] pdumper 1de3fa3 4/6: Remove obsolete todo comment, Daniel Colascione, 2018/02/19
- [Emacs-diffs] pdumper b7da1a5 6/6: Avoid -Wconversion error in dump_read_all under MS-Windows, Daniel Colascione, 2018/02/19
- [Emacs-diffs] pdumper d9dcb3f 3/6: Limit -Wconversion to GCC >= 4.7, Daniel Colascione, 2018/02/19
- [Emacs-diffs] pdumper 2971d13 5/6: Move unblock_input out of catch handler, Daniel Colascione, 2018/02/19
- [Emacs-diffs] pdumper 11976b6 1/6: Verify hashes of lisp structures during compilation, Daniel Colascione, 2018/02/19