(eval-when (:load-toplevel :compile-toplevel :execute)
+
+;;; Winsock is different w.r.t errno
+(defun socket-errno ()
+ "Get socket error code, usually from errno, but see #+win32."
+ #+win32 (sockint::wsa-get-last-error)
+ #-win32 (sb-unix::get-errno))
+
(defclass socket ()
((file-descriptor :initarg :descriptor
:reader socket-file-descriptor)
(size-of-sockaddr socket))))
(cond
((and (= fd -1)
- (member (sb-unix::get-errno)
+ (member (socket-errno)
(list sockint::EAGAIN sockint::EINTR)))
nil)
((= fd -1) (socket-error "accept"))
(sb-alien:addr sa-len))))
(cond
((and (= len -1)
- (member (sb-unix::get-errno)
+ (member (socket-errno)
(list sockint::EAGAIN sockint::EINTR)))
nil)
((= len -1) (socket-error "recvfrom"))
flags)))))
(cond
((and (= len -1)
- (member (sb-unix::get-errno)
+ (member (socket-errno)
(list sockint::EAGAIN sockint::EINTR)))
nil)
((= len -1)
;; FIXME: Our Texinfo documentation extracter need at least his to spit
;; out the signature. Real documentation would be better...
""
- (let* ((errno (sb-unix::get-errno))
+ (let* ((errno (socket-errno))
(condition (condition-for-errno errno)))
(error condition :errno errno :syscall where)))