From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72692 invoked by alias); 26 Feb 2019 09:46:34 -0000 Mailing-List: contact cygwin-cvs-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-cvs-owner@cygwin.com Received: (qmail 72647 invoked by uid 9078); 26 Feb 2019 09:46:33 -0000 Date: Tue, 26 Feb 2019 09:46:00 -0000 Message-ID: <20190226094633.72645.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: timerfd: reduce size of shared mem region to a single page X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 3b3ba558e90e7ce07eb0b9a5939453d4b90bd5e5 X-Git-Newrev: 5a483b6bcac263102df890c3172ecddf23fc9f53 X-SW-Source: 2019-q1/txt/msg00195.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5a483b6bcac263102df890c3172ecddf23fc9f53 commit 5a483b6bcac263102df890c3172ecddf23fc9f53 Author: Corinna Vinschen Date: Tue Feb 26 10:19:08 2019 +0100 Cygwin: timerfd: reduce size of shared mem region to a single page The share section was created using the PAGE_SIZE constant, but PAGE_SIZE is 64K. Fix that by using wincap.page_size() instead, which returns the desired actual page size of 4K. Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/timerfd.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/timerfd.cc b/winsup/cygwin/timerfd.cc index 418e71b..b0d4db9 100644 --- a/winsup/cygwin/timerfd.cc +++ b/winsup/cygwin/timerfd.cc @@ -210,8 +210,8 @@ timerfd_tracker::create (clockid_t clock_id) const ACCESS_MASK access = STANDARD_RIGHTS_REQUIRED | SECTION_MAP_READ | SECTION_MAP_WRITE; - SIZE_T vsize = PAGE_SIZE; - LARGE_INTEGER sectionsize = { QuadPart: PAGE_SIZE }; + SIZE_T vsize = wincap.page_size (); + LARGE_INTEGER sectionsize = { QuadPart: (LONGLONG) wincap.page_size () }; /* Valid clock? */ if (!get_clock (clock_id)) @@ -290,7 +290,7 @@ timerfd_tracker::create (clockid_t clock_id) /* Create section mapping (has to be recreated after fork/exec) */ tfd_shared = NULL; status = NtMapViewOfSection (tfd_shared_hdl, NtCurrentProcess (), - (void **) &tfd_shared, 0, PAGE_SIZE, NULL, + (void **) &tfd_shared, 0, vsize, NULL, &vsize, ViewShare, 0, PAGE_READWRITE); if (!NT_SUCCESS (status)) { @@ -397,7 +397,7 @@ timerfd_tracker::fixup_after_fork_exec (bool execing) { NTSTATUS status; OBJECT_ATTRIBUTES attr; - SIZE_T vsize = PAGE_SIZE; + SIZE_T vsize = wincap.page_size (); /* Run this only once per process */ if (winpid == GetCurrentProcessId ()) @@ -405,7 +405,7 @@ timerfd_tracker::fixup_after_fork_exec (bool execing) /* Recreate shared section mapping */ tfd_shared = NULL; status = NtMapViewOfSection (tfd_shared_hdl, NtCurrentProcess (), - (PVOID *) &tfd_shared, 0, PAGE_SIZE, NULL, + (PVOID *) &tfd_shared, 0, vsize, NULL, &vsize, ViewShare, 0, PAGE_READWRITE); if (!NT_SUCCESS (status)) api_fatal ("Can't recreate shared timerfd section during %s, status %y!",