About mmap

From: Sebastien Morand (sebastien@telesol.usm.my)
Date: Thu Oct 31 2002 - 09:05:09 EST


I'm implementing a cache for a database file system. Using mmap I
would like to know how mmap works.

For instance if my file is open in read/write and I'm mapping in
read/write but I use only the block in write, is the kernel going to
read on the disk?

Here is a sample code:
int h = open(file, O_RDWR | O_SYNC);
void * memory =
  mmap(0, pageSize, PROT_WRITE | PROT_READ, MAP_SHARED, handle, 0);

I'm actually using the same code to get read or write block, so if I'm
using the block in write only I would like to know if this code is
correct or if I'd better change the flags according to writing or
reading access.

Sincerely,
Sebastien Morand.

NB: I'm not on the mailing list, can you put my e-mail in CC to reply
please.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Oct 31 2002 - 22:00:53 EST