Matthew Curry | 21 Jun 2012 03:53
Picon

running a sbcl xinetd server (the rub: wait = yes)

Hi:

I was trying to make a xinetd tcp service, using sbcl, but with
'wait=yes' in the xinetd configuration.
What this means for tcp is that xinetd will start the server given in
the configuration, and pass the listen()'d socket as fd 0 in the child
process it spawns, which the child must accept(), and then xinetd
simply watches the child thereafter.  I've used xinetd before in this
way as a poor man's monitor process, because xinetd will restart the
child only if it dies on the next client connection, not every time a
client connects (as in the wait=no case).

However, the spawned process in this case being a sbcl script, I don't
know how to get at the fd 0 to do an accept() on it.

Attached are two (very quick) hacks, one in python, one in lisp.  The
python one works enough to show what I was trying to find; a socket
fromfd function.
The lisp one shows how I was trying to emulate fromfd(): basically
making a socket instance with :descriptor initarg of 0.

Thoughts?

-Matt

PS  running on ubuntu 12.04, sbcl-1.0.57+, xinetd config below:

service lisp-server
{
	disable		= yes
(Continue reading)


Gmane