/* Map it. */
address = mmap(NULL, request_size, PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_HASSEMAPHORE, fd, 0);
+ MAP_SHARED | MAP_HASSEMAPHORE | MAP_NOSYNC, fd, 0);
if (address == MAP_FAILED)
{
int save_errno;
/* Map it. */
address = mmap(NULL, request_size, PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_HASSEMAPHORE, fd, 0);
+ MAP_SHARED | MAP_HASSEMAPHORE | MAP_NOSYNC, fd, 0);
if (address == MAP_FAILED)
{
int save_errno;
#define MAP_HASSEMAPHORE 0
#endif
+/*
+ * BSD-derived systems use the MAP_NOSYNC flag to prevent dirty mmap(2)
+ * pages from being gratuitously flushed to disk.
+ */
+#ifndef MAP_NOSYNC
+#define MAP_NOSYNC 0
+#endif
+
#define PG_MMAP_FLAGS (MAP_SHARED|MAP_ANONYMOUS|MAP_HASSEMAPHORE)
/* Some really old systems don't define MAP_FAILED. */