public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John M Collins <jmc@xisl.com>
To: linux-kernel@vger.kernel.org
Subject: Question about memory-mapped files
Date: Wed, 28 May 2003 17:32:59 +0100	[thread overview]
Message-ID: <3ED4E4BB.10806@xisl.com> (raw)

Please cc me (jmc@removespam.xisl.com) in any reply as I'm not subscribed.

Could someone advise me on the answer to the following question:

If I invoke mmap to map a file to memory, and it succeeds, can I safely 
close the original file descriptor and rely on the memory still being 
mapped and the file still updated (possibly with mysnc)?

I've looked through the kernel (2.4) source and it seems I can. I've 
tried a test program on my machine and also Solaris and HP and it works 
OK the file getting updated.

On the Linux machine /proc/<pid>/maps seems to have all the right stuff 
in after the file is closed.

The only thing that doesn't happen is that the file mod time doesn't get 
changed (on any machine).

Of course "munmap" and "mremap" don't oblige you to pass an fd so it 
would seem logical. But no manual page actually seems to say it.

Could anyone advise? Thanks.

-- 
John Collins Xi Software Ltd www.xisl.com



             reply	other threads:[~2003-05-28 16:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-28 16:32 John M Collins [this message]
2003-05-28 17:26 ` Question about memory-mapped files Hugh Dickins
2003-05-28 19:20   ` John M Collins
2003-05-29  6:17     ` Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ED4E4BB.10806@xisl.com \
    --to=jmc@xisl.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox