From: Nico Schottelius <nico-linux-runit@schottelius.org>
Subject: Acessing IPC as init
Date: Mon, 9 May 2005 14:47:37 +0200 [thread overview]
Message-ID: <20050509124737.GA30884@schottelius.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 760 bytes --]
Hello!
I am also working on an init-system.
I saw how runit does IPC with two fifos for each service. I tried
to use unix-sockets (AF_UNIX), but bind() fails, as
a) it cannot create socket (fs is r/o at boot)
b) it says already bound (as socket exists)
So my questions now are:
a) is there a way to tell bind() to reuse the existing socket?
b) is a per-service fifo-based communication really the best
thing one wants for a parallel executing init?
I also attached my mail I posted to comp.unix.programmer, which
explains the problem more in detail.
Thanks for any hint,
Nico
--
Keep it simple & stupid, use what's available.
Please use pgp encryption: 8D0E 27A4 is my id.
http://nico.schotteli.us | http://linux.schottelius.org
[-- Attachment #2: comp.unix.programmer --]
[-- Type: text/plain, Size: 4064 bytes --]
From nico-news@schottelius.org Mon May 9 12:33:21 2005
Path: news.kamp.net!newsfeed2.kamp.net!195.62.97.9.MISMATCH!not-for-mail
Newsgroups: comp.unix.programmer
From: Nico Schottelius <nico-news@schottelius.org>
Subject: Unix IPC, socket/AF_UNIX; bind on r/o devices?
Organization: Schottelius Family, Hannover Germany
Message-ID: <slrnd7ucl9.lvm.nico-news@bruehe.schottelius.org>
User-Agent: slrn/0.9.8.1 (Debian)
Date: 09 May 2005 09:51:27 GMT
Lines: 43
NNTP-Posting-Host: 213.146.113.242
X-Trace: 1115632287 news.kamp.net 29225 213.146.113.242:59542
Xref: news.kamp.net comp.unix.programmer:3315
Hello!
Situation:
- everything mounted readonly (as when starting the system)
- one process with n children, which may have n children (recursive)
- all the children and children of children should be able to talk to the
first parent
Problem:
- Using bind() will fail, because
a) socket cannot created
b) the existing socket cannot be reused
Other possibilities not working:
- shared memory is not an option, as one need
-lrt, which needs -lpthread, which is problematic to link statically
- pipes: handling the pipes from parent to child of child of child
would be hard to program
- socketpair: should be the same problematic as it's with pipes
- fifos: one would have to create the fifos before and two fifos
for each child; possible, but very unelegant; and one would have
to memorize, which child is connected to which fifo; again possible,
but somehow unelegant
- signaling: one could implement communication with some kind of
morse code with signals, but that won't be a good solution
Questions:
- Is there any way, case b) (socket already existing) can be solved in
a way that I tell bind() to use an existing socket?
- What would be the best solution to talk bidirectional to clients
in this scenario?
I appreciate any hint, as I really like the socket mechanism and would
like to keep it.
Thanks in advance,
Nico
From nico-news@schottelius.org Mon May 9 14:49:59 2005
Path: news.kamp.net!newsfeed2.kamp.net!195.62.97.9.MISMATCH!not-for-mail
Newsgroups: comp.unix.programmer
From: Nico Schottelius <nico-news@schottelius.org>
Subject: Unix IPC, socket/AF_UNIX; bind on r/o devices?
Organization: Schottelius Family, Hannover Germany
Message-ID: <slrnd7ucl9.lvm.nico-news@bruehe.schottelius.org>
User-Agent: slrn/0.9.8.1 (Debian)
Date: 09 May 2005 09:51:27 GMT
Lines: 43
NNTP-Posting-Host: 213.146.113.242
X-Trace: 1115632287 news.kamp.net 29225 213.146.113.242:59542
Xref: news.kamp.net comp.unix.programmer:3315
Hello!
Situation:
- everything mounted readonly (as when starting the system)
- one process with n children, which may have n children (recursive)
- all the children and children of children should be able to talk to the
first parent
Problem:
- Using bind() will fail, because
a) socket cannot created
b) the existing socket cannot be reused
Other possibilities not working:
- shared memory is not an option, as one need
-lrt, which needs -lpthread, which is problematic to link statically
- pipes: handling the pipes from parent to child of child of child
would be hard to program
- socketpair: should be the same problematic as it's with pipes
- fifos: one would have to create the fifos before and two fifos
for each child; possible, but very unelegant; and one would have
to memorize, which child is connected to which fifo; again possible,
but somehow unelegant
- signaling: one could implement communication with some kind of
morse code with signals, but that won't be a good solution
Questions:
- Is there any way, case b) (socket already existing) can be solved in
a way that I tell bind() to use an existing socket?
- What would be the best solution to talk bidirectional to clients
in this scenario?
I appreciate any hint, as I really like the socket mechanism and would
like to keep it.
Thanks in advance,
Nico
reply other threads:[~2005-05-09 12:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20050509124737.GA30884@schottelius.org \
--to=nico-linux-runit@schottelius.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;
as well as URLs for NNTP newsgroup(s).