X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-bsd-sockets%2Flocal.lisp;h=53a7f85b5dbee0efbea0096882c065d8eef2f8e2;hb=05d9e55946615d14fa26d276b29072931f9dc5b5;hp=2350e06a5d08494883c5f04825fa940bc5f36e12;hpb=e449254c6a6a768b42a878274a90db9bb7d2ba2b;p=sbcl.git
diff --git a/contrib/sb-bsd-sockets/local.lisp b/contrib/sb-bsd-sockets/local.lisp
index 2350e06..53a7f85 100644
--- a/contrib/sb-bsd-sockets/local.lisp
+++ b/contrib/sb-bsd-sockets/local.lisp
@@ -1,40 +1,26 @@
(in-package :sb-bsd-sockets)
-#||
Local (unix) domain sockets
-
-Local domain (AF_LOCAL) sockets are also known as Unix-domain sockets, but were
-renamed by POSIX presumably on the basis that they may be
-available on other systems too.
-
-A local socket address is a string, which is used to create a node
-in the local filesystem. This means of course that they cannot be used across
-a network.
-
-||#
-
(defclass local-socket (socket)
- ((family :initform sockint::af-local)))
+ ((family :initform sockint::af-local))
+ (:documentation "Class representing local domain (AF_LOCAL) sockets,
+also known as unix-domain sockets."))
-(defmethod make-sockaddr-for ((socket local-socket) &optional sockaddr &rest address &aux (filename (first address)))
+(defmethod make-sockaddr-for ((socket local-socket)
+ &optional sockaddr &rest address &aux (filename (first address)))
(let ((sockaddr (or sockaddr (sockint::allocate-sockaddr-un))))
(setf (sockint::sockaddr-un-family sockaddr) sockint::af-local)
(when filename
- (loop for c across filename
- ;; XXX magic constant ew ew ew. should grovel this from
- ;; system headers
- for i from 0 to (min 107 (1- (length filename)))
- do (setf (sockint::sockaddr-un-path sockaddr i) (char-code c))
- finally
- (setf (sockint::sockaddr-un-path sockaddr (1+ i)) 0)))
+ (setf (sockint::sockaddr-un-path sockaddr) filename))
sockaddr))
+(defmethod free-sockaddr-for ((socket local-socket) sockaddr)
+ (sockint::free-sockaddr-un sockaddr))
+
(defmethod size-of-sockaddr ((socket local-socket))
sockint::size-of-sockaddr-un)
(defmethod bits-of-sockaddr ((socket local-socket) sockaddr)
"Return the file name of the local socket address SOCKADDR."
- (let ((name (sb-c-call::%naturalize-c-string
- (sb-sys:sap+ (sockint::array-data-address sockaddr)
- sockint::offset-of-sockaddr-un-path))))
+ (let ((name (sockint::sockaddr-un-path sockaddr)))
(if (zerop (length name)) nil name)))