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: mmap: constify pagesize throughout
Date: Mon, 20 Jul 2020 18:46:15 +0000 (GMT) [thread overview]
Message-ID: <20200720184616.017243861031@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=119e8d5c11318058880922625907b60b86875024
commit 119e8d5c11318058880922625907b60b86875024
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Mon Jul 20 17:53:29 2020 +0200
Cygwin: mmap: constify pagesize throughout
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/mmap.cc | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index a08d00f83..1fccc6c58 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -765,7 +765,7 @@ mmap_is_attached_or_noreserve (void *addr, size_t len)
LIST_LOCK ();
mmap_list *map_list = mmapped_areas.get_list_by_fd (-1, NULL);
- size_t pagesize = wincap.allocation_granularity ();
+ const size_t pagesize = wincap.allocation_granularity ();
caddr_t start_addr = (caddr_t) rounddown ((uintptr_t) addr, pagesize);
len += ((caddr_t) addr - start_addr);
len = roundup2 (len, pagesize);
@@ -852,7 +852,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, off_t off)
caddr_t base = NULL;
struct stat st;
- size_t pagesize = wincap.allocation_granularity ();
+ const size_t pagesize = wincap.allocation_granularity ();
fh_anonymous.set_handle (INVALID_HANDLE_VALUE);
fh_anonymous.set_access (GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE);
@@ -1227,7 +1227,7 @@ munmap (void *addr, size_t len)
set_errno (EINVAL);
return -1;
}
- size_t pagesize = wincap.allocation_granularity ();
+ const size_t pagesize = wincap.allocation_granularity ();
if (((uintptr_t) addr % pagesize) || !len)
{
set_errno (EINVAL);
@@ -1348,7 +1348,7 @@ mprotect (void *addr, size_t len, int prot)
syscall_printf ("mprotect (addr: %p, len %lu, prot %y)", addr, len, prot);
/* See comment in mmap64 for a description. */
- size_t pagesize = wincap.allocation_granularity ();
+ const size_t pagesize = wincap.allocation_granularity ();
if ((uintptr_t) addr % pagesize)
{
set_errno (EINVAL);
@@ -1433,7 +1433,7 @@ mlock (const void *addr, size_t len)
int ret = -1;
/* Align address and length values to page size. */
- size_t pagesize = wincap.allocation_granularity ();
+ const size_t pagesize = wincap.allocation_granularity ();
PVOID base = (PVOID) rounddown ((uintptr_t) addr, pagesize);
SIZE_T size = roundup2 (((uintptr_t) addr - (uintptr_t) base) + len,
pagesize);
@@ -1491,7 +1491,7 @@ munlock (const void *addr, size_t len)
int ret = -1;
/* Align address and length values to page size. */
- size_t pagesize = wincap.allocation_granularity ();
+ const size_t pagesize = wincap.allocation_granularity ();
PVOID base = (PVOID) rounddown ((uintptr_t) addr, pagesize);
SIZE_T size = roundup2 (((uintptr_t) addr - (uintptr_t) base) + len,
pagesize);
@@ -1539,7 +1539,7 @@ posix_madvise (void *addr, size_t len, int advice)
case POSIX_MADV_WILLNEED:
{
/* Align address and length values to page size. */
- size_t pagesize = wincap.allocation_granularity ();
+ const size_t pagesize = wincap.allocation_granularity ();
PVOID base = (PVOID) rounddown ((uintptr_t) addr, pagesize);
SIZE_T size = roundup2 (((uintptr_t) addr - (uintptr_t) base)
+ len, pagesize);
@@ -1560,7 +1560,7 @@ posix_madvise (void *addr, size_t len, int advice)
case POSIX_MADV_DONTNEED:
{
/* Align address and length values to page size. */
- size_t pagesize = wincap.allocation_granularity ();
+ const size_t pagesize = wincap.allocation_granularity ();
PVOID base = (PVOID) rounddown ((uintptr_t) addr, pagesize);
SIZE_T size = roundup2 (((uintptr_t) addr - (uintptr_t) base)
+ len, pagesize);
reply other threads:[~2020-07-20 18: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=20200720184616.017243861031@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: 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).