This program fails at the second mmap call with EINVAL: #include <stdio.h> #include <sys/mman.h> #include <error.h>
int main (void) { void * mem; /* Reserve 256MB address space for the minor heaps */ mem = mmap(0, 268439552, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (mem == MAP_FAILED) error(1, 0, "Reservation failed"); /* Commit the first 2MB heap */ if (mmap(mem, 2097152, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0) == MAP_FAILED) error(1, 0, "Commit failed"); } Is this something that's expected to fail for Cygwin, or a bug? The example is extracted from OCaml 5.0's runtime, which reserves an area of address space and then commits chunks of it as required. The above snippet comes from the Linux side, on Windows we're using VirtualAlloc with PAGE_NOACCESS to reserve the address space and then VirtualAlloc with MEM_COMMIT and PAGE_READWRITE to commit smaller portions of it. Is there a way to do that with Cygwin's mmap? Thanks, David -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple