1.0.13.32: fix run-sbcl.sh when sh != bash in disguise
[sbcl/simd.git] / contrib / sb-bsd-sockets / defpackage.lisp
blob5dfafa0d735d2235110c90cc3e060da0d17d5551
1 #+(and sbcl win32)
2 (defpackage "SB-WIN32-SOCKETS-INTERNAL"
3 (:nicknames "WIN32SOCKINT")
4 (:shadow close listen)
5 (:use "COMMON-LISP" "SB-ALIEN" "SB-EXT" "SB-C-CALL"))
7 (defpackage "SB-BSD-SOCKETS-INTERNAL"
8 (:nicknames "SOCKINT")
9 (:shadow close listen)
10 (:shadowing-import-from "SB-KERNEL" with-array-data)
11 (:use "COMMON-LISP" "SB-ALIEN" "SB-EXT" "SB-C-CALL"))
13 (defpackage "SB-BSD-SOCKETS"
14 (:export socket local-socket inet-socket
15 make-local-socket make-inet-socket
16 socket-bind socket-accept socket-connect
17 socket-send socket-receive socket-recv
18 socket-name socket-peername socket-listen
19 socket-close socket-file-descriptor
20 socket-family socket-protocol socket-open-p
21 socket-type socket-make-stream get-protocol-by-name
23 get-host-by-name get-host-by-address
24 host-ent
25 host-ent-addresses host-ent-address
26 host-ent-aliases host-ent-name
27 name-service-error
28 getaddrinfo
29 ;; not sure if these are really good names or not
30 netdb-internal-error
31 netdb-success-error
32 host-not-found-error
33 try-again-error
34 no-recovery-error
36 unknown-protocol
38 ;; all socket options are also exported, by code in
39 ;; sockopt.lisp
41 socket-error
43 ;; other errno-based socket errors are exported by code in
44 ;; sockets.lisp
46 make-inet-address
48 non-blocking-mode
50 (:use "COMMON-LISP" "SB-BSD-SOCKETS-INTERNAL")
51 (:import-from "SB-INT" "UNSUPPORTED-OPERATOR" "FEATUREP")
52 (:documentation
55 A thinly-disguised BSD socket API for SBCL. Ideas stolen from the BSD
56 socket API for C and Graham Barr's IO::Socket classes for Perl.
58 We represent sockets as CLOS objects, and rename a lot of methods and
59 arguments to fit Lisp style more closely.
64 ;;; gethostbyname/gethostbyaddr are generally not thread safe. POSIX
65 ;;; 1003.1-2003 defines an alternative API, which is specified in the
66 ;;; RFC to be thread-safe. If it seems to be available, use it.
67 ;;;
68 ;;; Unfortunately the manual page claims that these functions are not
69 ;;; thread-safe on OS X, but they probably can't be any worse than
70 ;;; gethostbyname and gethostbyaddr.
71 ;;;
72 ;;; CLH: getaddrinfo seems to be broken is broken on x86-64/darwin
73 #-(and x86-64 darwin)
74 (let ((addr (sb-alien::find-dynamic-foreign-symbol-address "getaddrinfo")))
75 (when addr
76 (pushnew :sb-bsd-sockets-addrinfo *features*)))