[usocket-devel] Create socket from file descriptor number
Maciej Pasternacki
japhy at zenbe.com
Wed May 20 15:32:16 UTC 2009
Hello,
I am investigating possibility of running FastCGI scripts with Lisp.
This is doable at least on SBCL and (recently, on trunk atm) Clozure
CL, since these implementations allow for creating a socket from file
descriptor as integer -- and FastCGI protocol includes the script
receiving a listening socket on FD 0 (stdin), which is a pattern
sometimes seen in UNIX world (e.g. inetd).
To get a socket from FD, I have to resort to using unexported functions
in conjunction with platform-specific calls:
(usocket::make-stream-server-socket
#+ccl (ccl:make-socket :address-family :internet :type :stream
:connect :passive :fd 0)
#+sbcl (make-instance 'sb-bsd-sockets:inet-socket :descriptor 0))
Is it possible to incorporate this usage pattern into usocket, and if
yes, how should I approach preparing the patch? I was thinking along
the lines of exporting MAKE-STREAM-SOCKET, MAKE-STREAM-SERVER-SOCKET,
and MAKE-DATAGRAM-SOCKET functions, making them accept either an
implementation-specific socket or integer file descriptor as first
argument, and adding relevant backend function for creating socket by
FD and element type. Would this be a correct approach, or would you
suggest another API?
Thanks,
Maciej.
--
Maciej Pasternacki -><- http://www.pasternacki.net/ -><-
http://www.3ofcoins.net/
More information about the usocket-devel
mailing list