This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: PCH support on Solaris


> Do you mean that this code under Solaris
>
> size = 1048576
> guess = mmap (NULL, size, PROT_NONE,
>     MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
> munmap (guess, size);
> addr = mmap (guess+4096, size-4096, PROT_NONE,
>     MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
> printf ("%x %x\n", guess, addr);
>
> gives the same address for both guess and size?  That is, that Solaris
> completely ignores the first argument unless MAP_FIXED is given?

It appears so, indeed.

> If so, my idea is useless at least under Solaris.  But if not, I don't see
> your point.

No, it is not useless under Solaris, since

guess = mmap (NULL, size, PROT_NONE, MAP_PRIVATE, fd, 0);
munmap (guess, size);
addr = mmap (guess, size-4096, PROT_READ, MAP_PRIVATE, fd, 4096);
printf ("%x %x\n", guess, addr);

doesn't return the same address.

-- 
Eric Botcazou


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