[Openmcl-devel] Unix domain sockets broken in Darwin x86?
danieldickison at gmail.com
Wed Nov 22 09:46:23 UTC 2006
I just applied the patch and everything seems to be working fine
now. Thanks for the fast fix!
On Nov 21, 2006, at 3:35 AM, Gary Byers wrote:
> I was going to say that aside from potential x86 vs PPC issues
> (endianness), the fact that a lot of stream code (including socket
> code) was rewritten and reorganized meant that that was also
> a likely suspect; the actual culprit seems to have been Unicode.
> Way back when, it was possible to copy a lisp string to foreign
> memory by just BLTing some number of 8-bit bytes/octets around.
> That worked fine, because lisp strings were just vectors of octets
> each of which encoded an 8-bit character code.
> If lisp strings are vectors of 32-bit (well, 21-bit ...) character
> codes, copying each of those octets to foreign memory (via some
> low-level BLTing function like CCL::%COPY-IVECTOR-TO-PTR) won't
> work so well (it'll usually copy about 3 NUL octets per character ...)
> This (BLTing octets from a lisp string to foreign memory) is what
> the function CCL::INIT-UNIX-SOCKADDR (in ccl:level-1;l1-sockets.lisp)
> was doing; that seems to have set the socket's "address" (pathname
> in the case of Unix sockets) to random nonsense with a lot of NULs
> in it, and (unless there was a named socket whose name was the same
> random nonsense visible) the connect would fail.
> I checked a fix for this and a few related issues into CVS a few
> minutes ago and it seems to work, at least in a simple test case. It
> should be easy to bootstrap the changes to l1-sockets.lisp from
> the 061110 images.
> On Tue, 21 Nov 2006, Daniel Dickison wrote:
>> I'm having trouble getting OpenMCL to connect to a Unix domain socket
>> using Version 1.1-pre-061110. The code works on PPC, I believe
>> OpenMCL 1.0, although it might have been an earlier 1.1 beta.
>> Unfortunately it's a little difficult to cross-check this now. Could
>> something between 1.0 and 1.1 have broken Unix domain sockets, or is
>> it a x86 vs PPC issue? And most importantly, how can I help track
>> this down?
>> Here's the relevant Lisp code -- this gets called from an Obj-C
>> frontend which runs OpenMCL as a background process:
>> (defvar *gui-socket* nil)
>> (defun start-gui-server (socket-path)
>> (process-run-function "fms-gui-server" #'gui-server socket-path))
>> (defun gui-server (socket-path)
>> (in-package :fms-cocoa-gui)
>> (with-open-socket (*gui-socket*
>> :remote-filename socket-path
>> :address-family :file
>> :type :stream
>> :connect :active)
>> (handler-case (let ((message (read *gui-socket*)))
>> (eval message))
>> (error (err)
>> (send-response +error-string+))
>> (:no-error (result &rest other-vals)
>> (declare (ignore other-vals))
>> (send-response result))))))
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
More information about the Openmcl-devel