Re: getpagesize() problems
Michele Alberti <[email protected]>
| Newsgroups | gmane.linux.lib.dietlibc |
|---|---|
| Message-ID | <[email protected]> |
> I recently changed the implementation of getpagesize() to use the
> information passed by the kernel in auxvec, when I added code to use
> auxvec for other reasons.
yes, I noticed that.
>
>> I investigated and discovered that getpagesize() makes the segfault.
>> In fact, if I define the PAGE_SIZE directly the project works well.
>
>> Then I made some tests with other stupid programs like:
>> #include <unistd.h>
>> #include <stdio.h>
>> #include <sys/user.h>
>
>> int main(void) {
>> int size = getpagesize();
>> int size2 = PAGE_SIZE-1;
>
>> printf("size: %u\n", size);
>> printf("size2: %u\n", size2);
>> return 0;
>> }
>
> This works fine for me (apart from the fact that sys/user.h does not
> exist for dietlibc and PAGE_SIZE is defined in sys/shm.h).
it works for you?! Maybe i'm not good in compiling and linking with
non-standard tools.
I'm telling this because I tried to use sys/shm.h but it gives me
error: PAGE_SIZE undeclared.
This is the command I made to compile and link:
$cc -static -o pagesize pagesize.c -nostdlib ../dietlibc.a -lgcc
/usr/bin/ld warns me that it can not find the _start symbol.
Running that example segfault immediately.
So I tried the other example, ld warns me again, but the example works well.
>
> What environment are you using this program in?
> x86? Inside user mode linux? What kernel version?
Debian i686, Linux 2.6.29.6
gcc: 4:4.3.3-9
libc6: 2.9-23
Hope this can help to understand.
thanks for your help.
Ciao
Michele