|
Boost : |
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2007-07-17 11:49:59
Wilbur Lang wrote:
> Hi,
>
> another problems in the same file.
>
> A) problem of align
> because mmap() requires:
> 1. offset should be a multiple of page size
> 2. the address start must be a multiple of page size.
> we have to align the offset and start to page size.
>
> for code snip begin from line 444,
> =====================================
> if(address){
> address = static_cast<const char*>(address) - m_extra_offset;
> }
> =====================================
>
> you make a wrong alignment for address.
>
> for example construct a mapped_region object with offset=1 and
> address=0x3f000002. m_extra_offset is 1, and calculated address is
> 0x3f000001 which is not page size aligned. another member variable have
> to imported to record the offset of address and m_base.
The result is that the user specifies both wrong address and offset
(both should be page_size aligned) and the call fails. I don't see why
Interprocess should try to support that. The user wants to map offset 1
in address 0x3f000002 and that will always fail. This is equivalent to
what the code tries: map offset 0 to 0x3f000001. And this will fail
according to POSIX (and Interprocess), so I don't see any problem. What
Interprocess can do at the top of the function is to check both
parameters to see if they are properly aligned and throw an error if any
of them is not correctly aligned. But I think current code will do the
same (throw an error).
> B) problem of m_size under windows
> in some case, the m_size is zero (0) under windows.
>
> code snipp begin at line 327 (mapped_region::flush)
> =====================================
> if(numbytes == 0) {
> numbytes = m_size - offset;
> }
> =====================================
> if m_size is 0, numbytes is a negative.
Ok. Thanks.
Regards,
Ion
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk