From: Topher <javert42@cs.byu.edu>
To: linux-c-programming@vger.kernel.org
Subject: mmap questions
Date: Mon, 17 Dec 2007 22:51:43 -0700 [thread overview]
Message-ID: <47675FEF.2010903@cs.byu.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 1015 bytes --]
I've read through the man pages on mmap, munmap, and msync, and I still
am not sure that I'm using the correct flags. Actually, I'm not even
completely sure that mmap is the way to go.
I'm creating a queue-like data structure that uses a fixed amount of
heap space. When it fills up, it must dump itself to a file, and then
it can consider itself "cleared", and continue adding elements. If a
remove() call is made on the structure, and it's currently empty but has
previously dumped to disk, it loads the data from disk, and then
continues. Also, this is only a single-threaded application.
I thought that I should use the MAP_PRIVATE flag when I map the file,
then just munmap() then call close(fd) when I dump it, but that's not
working. I'm just getting empty files.
Is mmap even the way to go, or should I just be using write() and read()?
--
Topher Fischer
GnuPG Fingerprint: 3597 1B8D C7A5 C5AF 2E19 EFF5 2FC3 BE99 D123 6674
javert42@cs.byu.edu | http://www.thetopher.com
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]
next reply other threads:[~2007-12-18 5:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-18 5:51 Topher [this message]
2007-12-18 17:17 ` mmap questions Glynn Clements
-- strict thread matches above, loose matches on Subject: below --
2002-10-28 17:16 vanDongen-Gilcher
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=47675FEF.2010903@cs.byu.edu \
--to=javert42@cs.byu.edu \
--cc=linux-c-programming@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.