X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=contrib%2Fsb-bsd-sockets%2Fname-service.lisp;h=d55ee8dba1205c34135302f573d20ec7f4badf11;hb=c03ebb54770cfa613d4b706a80e5be231786a5d0;hp=7ae73afbbca14ea84320a8d23ac926786adb75c1;hpb=2365c1b81d99c8e8e34665052f5b47be5cd6cd74;p=sbcl.git diff --git a/contrib/sb-bsd-sockets/name-service.lisp b/contrib/sb-bsd-sockets/name-service.lisp index 7ae73af..d55ee8d 100644 --- a/contrib/sb-bsd-sockets/name-service.lisp +++ b/contrib/sb-bsd-sockets/name-service.lisp @@ -24,7 +24,7 @@ ;(define-condition try-again-error (socket-error)) ; temporary (defun make-host-ent (h) - (if (sb-grovel::foreign-nullp h) (name-service-error "gethostbyname")) + (if (sb-alien:null-alien h) (name-service-error "gethostbyname")) (let* ((length (sockint::hostent-length h)) (aliases (loop for i = 0 then (1+ i) for al = (sb-alien:deref (sockint::hostent-aliases h) i) @@ -41,7 +41,8 @@ (loop for i from 0 below length do (setf (elt addr i) (sb-alien:deref ad i))) addr)) - (#.sockint::af-local + #-win32 + (#.sockint::af-local (sb-alien:cast ad sb-alien:c-string)))))) (make-instance 'host-ent :name (sockint::hostent-name h) @@ -81,6 +82,7 @@ GET-NAME-SERVICE-ERRNO") (get-name-service-errno) ;; Comment next to NETDB_INTERNAL in netdb.h says "See errno.". ;; This special case treatment hasn't actually been tested yet. + #-win32 (if (= *name-service-errno* sockint::NETDB-INTERNAL) (socket-error where) (let ((condition @@ -109,7 +111,9 @@ GET-NAME-SERVICE-ERRNO") (defparameter *conditions-for-name-service-errno* nil) +#-win32 (define-name-service-condition sockint::NETDB-INTERNAL netdb-internal-error) +#-win32 (define-name-service-condition sockint::NETDB-SUCCESS netdb-success-error) (define-name-service-condition sockint::HOST-NOT-FOUND host-not-found-error) (define-name-service-condition sockint::TRY-AGAIN try-again-error) @@ -122,16 +126,17 @@ GET-NAME-SERVICE-ERRNO") (or (cdr (assoc err *conditions-for-name-service-errno* :test #'eql)) 'name-service)) - - (defun get-name-service-errno () (setf *name-service-errno* (sb-alien:alien-funcall - (sb-alien:extern-alien "get_h_errno" (function integer))))) + #-win32 + (sb-alien:extern-alien "get_h_errno" (function integer)) + #+win32 + (sb-alien:extern-alien "WSAGetLastError" (function integer))))) #-(and cmu solaris) (progn - #+sbcl + #+(and sbcl (not win32)) (sb-alien:define-alien-routine "hstrerror" sb-c-call:c-string (errno integer)) @@ -142,3 +147,7 @@ GET-NAME-SERVICE-ERRNO") (defun get-name-service-error-message (num) (hstrerror num)) ) + +;;; placeholder for hstrerror on windows +#+(and sbcl win32) +(defun hstrerror () 0)