From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/786 Path: news.gmane.org!not-for-mail From: Nico Schottelius Newsgroups: gmane.comp.sysutils.supervision.general Subject: Acessing IPC as init Date: Mon, 9 May 2005 14:47:37 +0200 Message-ID: <20050509124737.GA30884@schottelius.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="WIyZ46R2i8wDzkSu" X-Trace: sea.gmane.org 1115642742 30544 80.91.229.2 (9 May 2005 12:45:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 9 May 2005 12:45:42 +0000 (UTC) Original-X-From: supervision-return-1022-gcsg-supervision=m.gmane.org@list.skarnet.org Mon May 09 14:45:33 2005 Return-path: Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1DV7cU-0002aj-6S for gcsg-supervision@gmane.org; Mon, 09 May 2005 14:44:22 +0200 Original-Received: (qmail 16653 invoked by uid 76); 9 May 2005 12:52:00 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 16647 invoked from network); 9 May 2005 12:52:00 -0000 Original-To: supervision@list.skarnet.org Content-Disposition: inline User-Agent: echo $message | gpg -e $sender -s | netcat mailhost 25 X-Linux-Info: http://linux.schottelius.org/ X-Operating-System: Linux 2.6.11.6 Xref: news.gmane.org gmane.comp.sysutils.supervision.general:786 X-Report-Spam: http://spam.gmane.org/gmane.comp.sysutils.supervision.general:786 --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="comp.unix.programmer" >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 Subject: Unix IPC, socket/AF_UNIX; bind on r/o devices? Organization: Schottelius Family, Hannover Germany Message-ID: 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 Subject: Unix IPC, socket/AF_UNIX; bind on r/o devices? Organization: Schottelius Family, Hannover Germany Message-ID: 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 --WIyZ46R2i8wDzkSu--