From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 017243861031; Mon, 20 Jul 2020 18:46:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 017243861031 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: mmap: constify pagesize throughout X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: d8a8d2ce5953af3383aff019596bdf7f7aef6c41 X-Git-Newrev: 119e8d5c11318058880922625907b60b86875024 Message-Id: <20200720184616.017243861031@sourceware.org> Date: Mon, 20 Jul 2020 18:46:15 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jul 2020 18:46:16 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=119e8d5c11318058880922625907b60b86875024 commit 119e8d5c11318058880922625907b60b86875024 Author: Corinna Vinschen Date: Mon Jul 20 17:53:29 2020 +0200 Cygwin: mmap: constify pagesize throughout Signed-off-by: Corinna Vinschen 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);