public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: timerfd: reduce size of shared mem region to a single page Date: Tue, 26 Feb 2019 09:46:00 -0000 [thread overview] Message-ID: <20190226094633.72645.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5a483b6bcac263102df890c3172ecddf23fc9f53 commit 5a483b6bcac263102df890c3172ecddf23fc9f53 Author: Corinna Vinschen <corinna@vinschen.de> 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 <corinna@vinschen.de> 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!",
reply other threads:[~2019-02-26 9:46 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20190226094633.72645.qmail@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /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: linkBe 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).