This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: mmap() on 64K aligned address fails
- From: Samuel Thibault <samuel dot thibault at ens-lyon dot org>
- To: cygwin at cygwin dot com
- Date: Sat, 26 Nov 2005 19:03:31 +0100
- Subject: Re: mmap() on 64K aligned address fails
- References: <dm8oki$48t$1@sea.gmane.org>
Hi,
René Berber, le Fri 25 Nov 2005 22:34:26 -0600, a écrit :
> #if !defined(__CYGWIN32__)
> data2 = (char *) malloc (2 * pagesize);
> if (!data2) {
> printf("second malloc failed\n");
> exit (1);
> }
> data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1);
> #else
> data2 = (char *) malloc (16 * pagesize);
> if (!data2) {
> printf("second malloc failed\n");
> exit (1);
> }
> printf("data2 before is %p\n", data2);
> data2 += (16*pagesize - ((long) data2 & (16*pagesize - 1))) & (16*pagesize - 1);
> printf("data2 after is %p\n", data2);
> #endif
This seems odd. In the cygwin case, pagesize() would not be sufficient ??
And anyway, it should rather be
data2 = (char *) malloc (2 * 16 * pagesize);
Not only 16 (since it is further 16*pagesize -aligned).
Regards,
Samuel
--
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/