* mmap.cc (list::match): Check using pagesize aligned size.

This commit is contained in:
Corinna Vinschen 2002-06-27 13:01:35 +00:00
parent 75c6a983c6
commit 5b509758a0
2 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -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;
}