Martin Sebor wrote:
>
> Travis Vitek wrote:
>>
>>>
>>> It looks like th original code was stepping 16MB (1024 * 1024 bytes)
>>> past bad_address. That should be well more than one page away. BTW, you
>>> can determine the kernel page size on most *nix platforms with sysconf
>>> (_SC_PAGESIZE).
>>>
>>> Travis
>>>
>>
>> Of course the kernel memory page size from sysconf() isn't the same as
>> the virtual memory page size that you are talking about. :)
>
> It's not? I thought both sysconf(_SC_PAGESIZE) and getpagesize()
> returned the size of the virtual page. I.e., whatever smallest
> unit mmap() allocates.
>
> Martin
>
I think I may have worded my response poorly. The page size, as returned by
sysconf(), is does not appear to be the same as the page size that is set by
chatr.
$ cat u.cpp && aCC u.cpp
#include <stdio.h>
#include <unistd.h>
int main ()
{
printf ("%ld\n", sysconf (_SC_PAGE_SIZE));
return 0;
}
$ chatr +pd 1M +pi 1M a.out > /dev/null && ./a.out
4096
$ chatr +pd 4M +pi 4M a.out > /dev/null && ./a.out
4096
A quick glance at the documentation for chatr says that +pd and +pi are only
hints for the virtual memory page size, so that may explain the difference
I'm seeing. Interestingly, you can set values for up to 4GB.
Travis
--
View this message in context:
http://www.nabble.com/-PATCH--STDCXX-705-tp15168662p15171629.html
Sent from the stdcxx-dev mailing list archive at Nabble.com.