This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mmap() on 64K aligned address fails


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]