public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Richard H Lee <ricardohenrylee@gmail.com>
To: cygwin@cygwin.com
Subject: [ATTN: PHP maintainer] Re: Fix for REAL_PAGE_SIZE in PHP
Date: Thu, 04 May 2017 14:39:00 -0000	[thread overview]
Message-ID: <b2264fb1-2d41-b8f5-c762-a4adefeef053@gmail.com> (raw)
In-Reply-To: <528aeb1a-9a9d-0afd-7372-576e8c94ae81@gmail.com>

Here is my proposed patch for this bug:

diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c
index 3fd7fa0..f5b9bea 100644
--- a/Zend/zend_stream.c
+++ b/Zend/zend_stream.c
@@ -30,7 +30,11 @@
  # if HAVE_UNISTD_H
  #  include <unistd.h>
  #  if defined(_SC_PAGESIZE)
+#   ifdef __CYGWIN__
+#    define REAL_PAGE_SIZE 4096
+#   else
  #    define REAL_PAGE_SIZE sysconf(_SC_PAGESIZE);
+#   endif
  #  elif defined(_SC_PAGE_SIZE)
  #    define REAL_PAGE_SIZE sysconf(_SC_PAGE_SIZE);
  #  endif
diff --git a/main/main.c b/main/main.c
index 01ed3a6..0909309 100644
--- a/main/main.c
+++ b/main/main.c
@@ -96,7 +96,11 @@
  # if HAVE_UNISTD_H
  #  include <unistd.h>
  #  if defined(_SC_PAGESIZE)
+#   ifdef __CYGWIN__
+#    define REAL_PAGE_SIZE 4096
+#   else
  #    define REAL_PAGE_SIZE sysconf(_SC_PAGESIZE);
+#   endif
  #  elif defined(_SC_PAGE_SIZE)
  #    define REAL_PAGE_SIZE sysconf(_SC_PAGE_SIZE);
  #  endif

This definition needs to be fixed in two places as there are two
different places where a PHP source file can be mmap()ed, depending on
whether it is loaded using php-cli or loaded when php is run from a library.

On 02/05/2017 11:28, Richard H Lee wrote:
> Should this fix go upstream to PHP or be submitted to the PHP
> package within Cygwin?

I ask this as partially accessibly memory pages I guess are a quirk of
Cygwin. But then again programs ideally should not read past the end of
the EOF in the region the file is mmap()ed to.


Richard

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

      reply	other threads:[~2017-05-04 14:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 10:28 Richard H Lee
2017-05-04 14:39 ` Richard H Lee [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2264fb1-2d41-b8f5-c762-a4adefeef053@gmail.com \
    --to=ricardohenrylee@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).