wiki:InitUnixSockAddr

Version 1 (modified by bfulgham, 7 years ago) (diff)

--

INIT-UNIX-SOCKADDR

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.

In OpenMCL, strings are vectors of 32-bit (well, 21-bit ...) character codes. Therefore, 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 ...)

The function CCL::INIT-UNIX-SOCKADDR (in ccl:level-1;l1-sockets.lisp) set the socket's "address" (pathname in the case of Unix sockets) to an appropriate native string (rather than the random nonsense with a lot of NULs in it we would get by naively BLTing the string contents).