Mail Archives: cygwin/2005/11/26/17:55:31
Samuel Thibault wrote:
[snip]
>>No, in windows there is a requirement that mmap uses memory aligned to 64=
k (the
>>infamous granularity).
>=20
> Then the result of pagesize() is not sufficiently big: POSIX says that
> mmap() can return EINVAL if =AB the address [...] is not a multiple of
> the page size, or is considered invalid by the implementation =BB. Well,
> we could consider non-16-pages-alignment as `considered invalid', but I
> guess this expression was meant as `not in a mmap()-able area'.
mmap() is returning an error code, probably EINVAL I just ddisn't care to l=
ook
what was it because there shouldn't be an error.
[snip]
> 16 pages
> are still not enough: if malloc() returns 0x0001 for instance, you'll
> round up that to 16*pagesize, which is out the allocated area. 17 pages
> are necessary.
Yes, that would produce an error... not the one you are saying but the "ali=
gned"
result will fall at the end with less than a pagesize available for mmap.
> BTW, I don't understand why using so complicated code:
> p +=3D (align - ((long) p & (align-1))) & (align-1)
> Isn't
> p =3D ((long) p + (align-1)) & (align-1)
> both faster (tested) and more readable ?
I didn't write the original code, it is from gcc-4.0.2 and it's used all ov=
er
the place to make libraries (libstdc, libgcj, perhaps others) and tools. T=
here
are other mmap() tests that fail (mmap from /dev/zero, mmap with MAP_ANON) =
I'm
just starting to look around to see what is the problem, and perhaps send a
patch to the gcc maintainers so we can have a fully functional set of libra=
ries.
Regards.
--=20
Ren=E9 Berber
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -