Subject: Re: making a virtual file system
From: rpw3@rpw3.org (Rob Warnock)
Date: Sat, 10 Jan 2009 20:22:58 -0600
Newsgroups: comp.lang.lisp
Message-ID: <p42dnbxaCIWfxfTUnZ2dnUVZ_vGdnZ2d@speakeasy.net>
budden  <budden-lisp@mail.ru> wrote:
+---------------
| > Entries for symbol functions would be executable
| This looks really useful. E.g. it allows to incorporate lisp into
| makefiles efficiently or to do a CGI efficiently. Instead of loading
| new lisp image every time, just call a lisp function. But I think this
| could also be achieved by writing a lightweight client written in C
| and a lisp server. I'm almost sure it is done already though I was
| unable to find a one. Swank/telnet seem not to work for me.
+---------------

Feel free to mine this one for ideas:

    http://rpw3.org/hacks/lisp/cgi_sock.c

It was originally written to provide a rough equivalent to the
"mod_lisp" Apache module but as a separate external CGI program.
However, I've also hacked up versions on occasion to pass command
line argument to the persistent CL application server "as if"
they'd come from the Web.

The biggest problem with the "C client/Lisp server" model is
securing the connection without compromising the lightweight
nature of the protocol. [That is, you don't want to run a whole
OpenSSL suite, which would be more expensive than fork/exec'ing
a new Lisp image!]  On Linux/Unix systems, that can be easily
accomplished by (1) using only local domain sockets (AF_UNIX,
AF_LOCAL, or AF_POSIX, depending on your operating system's stack),
*not* TCP, and (2) securing access to the directory *above* the
socket, since some operating systems ignore the file permissions
on the socket file itself.


-Rob

p.s. There's also a matching stub server in C that might be helpful
while debugging your Lisp server:

    http://rpw3.org/hacks/lisp/cgi_sockd.c

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607