From: Lassi Kortela <lassi@lassi.io>
To: 9fans@9fans.net
Subject: [9fans] POSIX shared memory (shm_open)
Date: Wed, 24 Apr 2019 18:22:35 +0300 [thread overview]
Message-ID: <f199b608-fae3-f96b-4fd2-92c4aac700db@lassi.io> (raw)
Hello,
Can the POSIX shared memory API be emulated on Plan 9 with reasonable
effort? I didn't find any mention of 'shm_open' in Plan 9 source.
To recap, the API works as follows:
- shm_open(path) to open or create an shm object, get a file descriptor
- shm_unlink(path) to remove the shm object from the path namespace
- ftruncate(fd) to actually allocate n bytes for the shm object
- fstat(fd) returns the size of the object in the st_size field
- mmap(fd) to get a pointer to use the shared memory
The shm fd works like other Unix fds (can be sent to an unrelated
process over a Unix-domain socket, persists over fork(), and can persist
over exec() if the close-on-exec flag is cleared). The kernel garbage
collects the shm object after the last fd pointing to it is closed.
I made the shim <https://github.com/lassik/shm_open_anon> to provide a
"shm_open() without a pathname" on various Unix flavors. I'm wondering
if Plan 9 support could be easily added.
I should mention that I have never used Plan 9, just read some of the
source and documentation.
Regards,
Lassi
next reply other threads:[~2019-04-24 15:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 15:22 Lassi Kortela [this message]
2019-04-25 4:28 ` Ori Bernstein
2019-04-25 14:25 ` Charles Forsyth
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=f199b608-fae3-f96b-4fd2-92c4aac700db@lassi.io \
--to=lassi@lassi.io \
--cc=9fans@9fans.net \
/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;
as well as URLs for NNTP newsgroup(s).