supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* Acessing IPC as init
@ 2005-05-09 12:47 Nico Schottelius
  0 siblings, 0 replies; only message in thread
From: Nico Schottelius @ 2005-05-09 12:47 UTC (permalink / 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-05-09 12:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-09 12:47 Acessing IPC as init Nico Schottelius

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).