public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: mmap: constify pagesize throughout
@ 2020-07-20 18:46 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2020-07-20 18:46 UTC (permalink / raw)
  To: cygwin-cvs

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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-20 18:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 18:46 [newlib-cygwin] Cygwin: mmap: constify pagesize throughout Corinna Vinschen

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).