This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libiberty patch]: Change strncmp test in the way it uses mmap
At 2:46 PM -0500 12/31/01, DJ Delorie wrote:
> > What's wrong with the change I did? Yes, both kinds of mmap's could
>> be done. But what's wrong with doing the anonymous mmap if that is
>> available and the "/dev/zero" file mmap if not. Why do both?
>
>Well, what's wrong with doing the /dev/zero file mmap is available,
>and anonymous if not?
I don't see why you seem so "protective" of doing that /dev/zero form when the other works equally as well (and in our case is necessary) and when it can be determined which to use based on the definitions of MAP_ANON and MAP_ANONYMOUS.
I changed the original macro sequence,
#ifndef MAP_ANON
#ifdef MAP_ANONYMOUS
#define MAP_ANON MAP_ANONYMOUS
#else
#define MAP_ANON MAP_FILE
#endif
#endif
to,
#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
#define MAP_ANONYMOUS MAP_ANON
#endif
And then MAP_ANONYMOUS controls which mmap to do. I still see no reason to do both.
Ira