static int
dump_get_page_size (void)
{
-#ifdef WINDOWSNT
+#if defined (WINDOWSNT) || defined (CYGWIN)
return 64 * 1024; /* Worst-case allocation granularity. */
#else
return getpagesize ();
dump_unmap_file (map->mapping, map->spec.size);
}
+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,
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]);
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
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;
{
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]);