* mmap.cc (class mmap_record): Pack 4 byte-aligned. Convert member dev

to plain int.
	(mmap_record::alloc_fh): Create temporary device from dev and use in
	call to build_fh_dev.
This commit is contained in:
Corinna Vinschen 2011-03-18 13:42:03 +00:00
parent ac706ac123
commit bf69faeb0d
2 changed files with 16 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2011-03-18 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (class mmap_record): Pack 4 byte-aligned. Convert member dev
to plain int.
(mmap_record::alloc_fh): Create temporary device from dev and use in
call to build_fh_dev.
2011-03-18 Corinna Vinschen <corinna@vinschen.de> 2011-03-18 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (mmap_record::page_map): Define as variable array rather than * mmap.cc (mmap_record::page_map): Define as variable array rather than

View File

@ -245,6 +245,7 @@ MapView (HANDLE h, void *addr, size_t len, DWORD openflags,
per mapped memory page. The bit is set if the page is accessible, per mapped memory page. The bit is set if the page is accessible,
unset otherwise. */ unset otherwise. */
#pragma pack(push, 4)
class mmap_record class mmap_record
{ {
public: public:
@ -259,7 +260,7 @@ class mmap_record
_off64_t offset; _off64_t offset;
DWORD len; DWORD len;
caddr_t base_address; caddr_t base_address;
device dev; int dev;
DWORD page_map[0]; DWORD page_map[0];
public: public:
@ -274,16 +275,16 @@ class mmap_record
len (l), len (l),
base_address (b) base_address (b)
{ {
dev.devn = 0; dev = 0;
if (fd >= 0 && !cygheap->fdtab.not_open (fd)) if (fd >= 0 && !cygheap->fdtab.not_open (fd))
dev = cygheap->fdtab[fd]->dev (); dev = cygheap->fdtab[fd]->dev ();
else if (fd == -1) else if (fd == -1)
dev.parse (FH_ZERO); dev = FH_ZERO;
} }
int get_fd () const { return fd; } int get_fd () const { return fd; }
HANDLE get_handle () const { return mapping_hdl; } HANDLE get_handle () const { return mapping_hdl; }
device& get_device () { return dev; } int get_device () { return dev; }
int get_prot () const { return prot; } int get_prot () const { return prot; }
int get_openflags () const { return openflags; } int get_openflags () const { return openflags; }
int get_flags () const { return flags; } int get_flags () const { return flags; }
@ -316,6 +317,7 @@ class mmap_record
{ return ::gen_protect (get_prot (), get_flags ()); } { return ::gen_protect (get_prot (), get_flags ()); }
bool compatible_flags (int fl) const; bool compatible_flags (int fl) const;
}; };
#pragma pack(pop)
class mmap_list class mmap_list
{ {
@ -519,7 +521,9 @@ mmap_record::alloc_fh ()
the call to fork(). This requires creating a fhandler the call to fork(). This requires creating a fhandler
of the correct type to be sure to call the method of the of the correct type to be sure to call the method of the
correct class. */ correct class. */
fhandler_base *fh = build_fh_dev (get_device ()); device fdev;
fdev.parse (get_device ());
fhandler_base *fh = build_fh_dev (fdev, "");
fh->set_access (get_openflags ()); fh->set_access (get_openflags ());
return fh; return fh;
} }