Re: [HACKERS] Memory mapping (Was: Safe/Fast I/O ...)

Matthew N. Dodd <winter@jurai.net>

From: "Matthew N. Dodd" <winter@jurai.net>
To: Michal Mosiewicz <mimo@interdata.com.pl>
Cc: pgsql-hackers@postgreSQL.org
Date: 1998-04-15T02:13:54Z
Lists: pgsql-hackers
On Wed, 15 Apr 1998, Michal Mosiewicz wrote:
> isolated from files it's possible to close some descriptors without
> throwing buffers. However it seems (tried it) that memory mapping works
> even after a file descriptor is closed. So, is this possible to cross
> the limit of open files by using memory mapping? Or maybe the descriptor
> remains open until munmap call? Or maybe it's just a Linux feature?

Nope, thats how it works.

A good friend of mine used this in some modifications to INN (probably in
INN -current right now).  

Sending an article involved opening the file, mmapping it, closing the fd,
writing the mapped area and munmap-ing.

Its pretty slick.

Be careful of the file changing under you.

/* 
   Matthew N. Dodd		| A memory retaining a love you had for life	
   winter@jurai.net		| As cruel as it seems nothing ever seems to
   http://www.jurai.net/~winter | go right - FLA M 3.1:53	
*/