From: Cyrus Harmon Date: Tue, 6 Mar 2007 23:26:32 +0000 (+0000) Subject: 1.0.3.33: sb-bsd-sockets fixes for x86-64/darwin X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=faaefce871eb7e00b0c9d23321e5cdfce25f418d;p=sbcl.git 1.0.3.33: sb-bsd-sockets fixes for x86-64/darwin * add gethostbyname2 (#+darwin) * make ai_addrlen be a socklen_t (#+darwin) * turn off :sb-bsd-sockets-addrinfo on x86-64/darwin as this seems to be broken * workaround gethostbyname length bug by alllowing length 4 or 8 on x86-64 darwin --- diff --git a/contrib/sb-bsd-sockets/constants.lisp b/contrib/sb-bsd-sockets/constants.lisp index 5cd6f72..2fcb27c 100644 --- a/contrib/sb-bsd-sockets/constants.lisp +++ b/contrib/sb-bsd-sockets/constants.lisp @@ -211,6 +211,10 @@ (msg (* msghdr)) (flags int))) (:function gethostbyname ("gethostbyname" (* hostent) (name c-string))) + #+darwin + (:function gethostbyname2 ("gethostbyname2" (* hostent) + (name c-string) + (af int))) (:function gethostbyaddr ("gethostbyaddr" (* hostent) (addr (* t)) (len int) @@ -235,7 +239,14 @@ (integer family "int" "ai_family") (integer socktype "int" "ai_socktype") (integer protocol "int" "ai_protocol") - (integer addrlen "size_t""ai_addrlen") + ;; CLH 20070306 FIXME: ai_addrlen should really + ;; be a socklen_t, but I'm not sure if this the + ;; case on other platforms. I'm setting this to + ;; socklen_t on darwin and hoping that other + ;; platform maintainers will do the right thing + ;; here. + #+darwin (integer addrlen "socklen_t" "ai_addrlen") + #-darwin (integer addrlen "size_t" "ai_addrlen") ((* sockaddr-in) addr "struct sockaddr*" "ai_addr") (c-string canonname "char *" "ai_canonname") ((* t) next "struct addrinfo*" "ai_next"))) diff --git a/contrib/sb-bsd-sockets/defpackage.lisp b/contrib/sb-bsd-sockets/defpackage.lisp index d0d23b8..5dfafa0 100644 --- a/contrib/sb-bsd-sockets/defpackage.lisp +++ b/contrib/sb-bsd-sockets/defpackage.lisp @@ -68,6 +68,9 @@ arguments to fit Lisp style more closely. ;;; Unfortunately the manual page claims that these functions are not ;;; thread-safe on OS X, but they probably can't be any worse than ;;; gethostbyname and gethostbyaddr. +;;; +;;; CLH: getaddrinfo seems to be broken is broken on x86-64/darwin +#-(and x86-64 darwin) (let ((addr (sb-alien::find-dynamic-foreign-symbol-address "getaddrinfo"))) (when addr (pushnew :sb-bsd-sockets-addrinfo *features*))) diff --git a/contrib/sb-bsd-sockets/name-service.lisp b/contrib/sb-bsd-sockets/name-service.lisp index f375562..40c9cf5 100644 --- a/contrib/sb-bsd-sockets/name-service.lisp +++ b/contrib/sb-bsd-sockets/name-service.lisp @@ -34,8 +34,16 @@ until (sb-alien:null-alien ad) collect (ecase (sockint::hostent-type h) (#.sockint::af-inet + ;; CLH: Work around x86-64 darwin bug here. + ;; The length is reported as 8, when it should be 4. + #+(and darwin x86-64) + (progn + (assert (or (= length 4) (= length 8))) + (naturalize-unsigned-byte-8-array ad 4)) + #-(and darwin x86-64) + (progn (assert (= length 4)) - (naturalize-unsigned-byte-8-array ad length)) + (naturalize-unsigned-byte-8-array ad length))) #-win32 (#.sockint::af-local (sb-alien:cast ad sb-alien:c-string)))))) diff --git a/version.lisp-expr b/version.lisp-expr index fc3275f..b1033d0 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.3.32" +"1.0.3.33"