aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2002-06-27 13:01:35 +0000
committerCorinna Vinschen <corinna@vinschen.de>2002-06-27 13:01:35 +0000
commit5b509758a00995bcda2d1c5864f74a9f02fedbde (patch)
tree692f88beea66e49541006404447c923384268f49
parent75c6a983c64a5ec0680be94587dd5946e0003363 (diff)
downloadnewlib-5b509758a00995bcda2d1c5864f74a9f02fedbde.zip
newlib-5b509758a00995bcda2d1c5864f74a9f02fedbde.tar.gz
newlib-5b509758a00995bcda2d1c5864f74a9f02fedbde.tar.bz2
* mmap.cc (list::match): Check using pagesize aligned size.
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/mmap.cc10
2 files changed, 10 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 18dd012..4d3acc7 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2002-06-27 Corinna Vinschen <corinna@vinschen.de>
+
+ * mmap.cc (list::match): Check using pagesize aligned size.
+
2002-06-26 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Force
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index c89cf4c..d1bda79 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -23,10 +23,10 @@ details. */
#include "pinfo.h"
#include "sys/cygwin.h"
-#define PAGE_CNT(bytes) howmany(bytes,getpagesize())
+#define PAGE_CNT(bytes) howmany((bytes),getpagesize())
#define PGBITS (sizeof(DWORD)*8)
-#define MAPSIZE(pages) howmany(pages,PGBITS)
+#define MAPSIZE(pages) howmany((pages),PGBITS)
#define MAP_SET(n) (map_map_[(n)/PGBITS] |= (1L << ((n) % PGBITS)))
#define MAP_CLR(n) (map_map_[(n)/PGBITS] &= ~(1L << ((n) % PGBITS)))
@@ -315,7 +315,8 @@ list::match (__off64_t off, DWORD len)
{
for (int i = 0; i < nrecs; ++i)
if (off >= recs[i].get_offset ()
- && off + len <= recs[i].get_offset () + recs[i].get_size ())
+ && off + len <= recs[i].get_offset ()
+ + (PAGE_CNT (recs[i].get_size ()) * getpagesize ()))
return recs + i;
}
return NULL;
@@ -327,7 +328,8 @@ list::match (caddr_t addr, DWORD len, __off32_t start)
{
for (int i = start + 1; i < nrecs; ++i)
if (addr >= recs[i].get_address ()
- && addr + len <= recs[i].get_address () + recs[i].get_size ())
+ && addr + len <= recs[i].get_address ()
+ + (PAGE_CNT (recs[i].get_size ()) * getpagesize ()))
return i;
return -1;
}