Wireshark-dev: Re: [Wireshark-dev] Use of MAP_ANON in epan/emem.c

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Fri, 16 Jun 2006 19:49:20 -0700

On Jun 16, 2006, at 6:11 PM, Guy Harris wrote:

The IRIX 6.5 man page for /dev/zero indicates you can mmap it to get
anonymous pages.  Are there any UN*Xes we support that *don't* allow
you to mmap /dev/zero to get anonymous pages?

Yes - it appears that FreeBSD and OS X don't.

if so, we might want to use MAP_ANONYMOUS on systems that
define it, otherwise use MAP_ANON on systems that define it (OS X
10.4 defines MAP_ANON but *NOT* MAP_ANONYMOUS, and that seems to be a
general BSD characteristic - I don't find any definitions of
MAP_ANONYMOUS in the sys/sys source directory of fairly recent
{Free,Net,Open}BSD), otherwise use "/dev/zero".

I've checked in a change to do that. It allows Wireshark to build on OS X (the change of MAP_ANON to MAP_ANONYMOUS probably broke {Free,Open,Net,DragonFly}BSD builds as well), and it includes untested code to handle systems that have neither MAP_ANONYMOUS nor MAP_ANON - it assumes they have /dev/zero, opens that, and maps it.