Re: [HACKERS] mmap and MAP_ANON - Mailing list pgsql-hackers

From Göran Thyni
Subject Re: [HACKERS] mmap and MAP_ANON
Date
Msg-id 3557067A.5D550A31@bildbasen.se
Whole thread Raw
In response to mmap and MAP_ANON  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian wrote:
>
> Would people tell me what platforms do NOT support the MAP_ANON flag to
> the mmap() system call?  You should find it in the mmap() manual page.
>
> *BSD has it, but I am not sure of the others.  I am researching cache
> size issues and the use of mmap vs. SYSV shared memory.

SVR4 (at least older ones) does not support MMAP_ANON,
but the recommended in W. Richards Stevens'
"Advanced programming in the Unix environment" (aka the Bible part 2)
is to use /dev/zero.

This should be configurable with autoconf:

<PSEUDO CODE>

if (exists MAP_ANON) use it; else use /dev/zero

------------

flags = MAP_SHARED;
#ifdef HAS_MMAP_ANON
fd = -1;
flags |= MAP_ANON;
#else
fd = open('/dev/zero, O_RDWR);
#endif
area = mmap(0, size, PROT_READ|PROT_WRITE, flags, fd, 0);

</PSEUDO CODE>


    regards,
--
---------------------------------------------
Göran Thyni, sysadm, JMS Bildbasen, Kiruna

pgsql-hackers by date:

Previous
From: dj@pelf.harvard.edu (Diab Jerius)
Date:
Subject: Re: [HACKERS] mmap and MAP_ANON
Next
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] money or dollar type