page_size vs allocation_granularity

Ken Brown kbrown@cornell.edu
Tue Jul 21 22:40:10 GMT 2020


Hi Corinna,

I'm curious about the design decision that causes sysconf(_SC_PAGESIZE) to 
return wincap.allocation_granularity() rather than wincap.page_size().  Changing 
this would improve Linux compatibility, I think, but maybe it would have some 
bad consequences that I'm not aware of.

I'm asking because in my recent fooling around with php, I noticed that Yaakov 
had to apply the following Cygwin-specific patch to avoid a crash:

--- origsrc/php-7.1.13/Zend/zend_stream.c	2018-01-02 20:32:22.000000000 -0600
+++ src/php-7.1.13/Zend/zend_stream.c	2018-01-09 01:42:30.871472500 -0600
@@ -29,7 +29,9 @@
  #if HAVE_MMAP
  # if HAVE_UNISTD_H
  #  include <unistd.h>
-#  if defined(_SC_PAGESIZE)
+#  if defined(__CYGWIN__)
+#    define REAL_PAGE_SIZE 4096
+#  elif defined(_SC_PAGESIZE)
  #    define REAL_PAGE_SIZE sysconf(_SC_PAGESIZE);
  #  elif defined(_SC_PAGE_SIZE)
  #    define REAL_PAGE_SIZE sysconf(_SC_PAGE_SIZE);

Ken


More information about the Cygwin-developers mailing list