/usr/share/sbcl-source/contrib/sb-bsd-sockets/misc.lisp is in sbcl-source 2:1.0.57.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | (in-package :sb-bsd-sockets)
;;; Miscellaneous things, placed here until I can find a logically more
;;; coherent place to put them
;;; I don't want to provide a complete interface to unix file
;;; operations, for example, but being about to set O_NONBLOCK on a
;;; socket is a necessary operation.
;;; XXX bad (sizeof (int) ==4 ) assumptions
(defgeneric non-blocking-mode (socket)
(:documentation "Is SOCKET in non-blocking mode?"))
#-win32
(defmethod non-blocking-mode ((socket socket))
(let ((fd (socket-file-descriptor socket)))
(sb-alien:with-alien ((arg integer))
(> (logand
(sockint::fcntl fd sockint::f-getfl arg)
sockint::o-nonblock)
0))))
#+win32
(defmethod non-blocking-mode ((socket socket)) 0)
(defgeneric (setf non-blocking-mode) (non-blocking-p socket)
(:documentation "Put SOCKET in non-blocking mode - or not, according to NON-BLOCKING-P"))
#-win32
(defmethod (setf non-blocking-mode) (non-blocking-p (socket socket))
(declare (optimize (speed 3)))
(let* ((fd (socket-file-descriptor socket))
(arg1 (the (signed-byte 32) (sockint::fcntl fd sockint::f-getfl 0)))
(arg2
(if non-blocking-p
(logior arg1 sockint::o-nonblock)
(logand (lognot sockint::o-nonblock) arg1))))
(when (= (the (signed-byte 32) -1)
(the (signed-byte 32)
(sockint::fcntl fd sockint::f-setfl arg2)))
(socket-error "fcntl"))
non-blocking-p))
#+win32
(defmethod (setf non-blocking-mode) (non-blocking-p (socket socket)) 0)
;; (sb-alien:with-alien ((mode (unsigned 32)))
;; (if non-blocking-p (setf mode 1))
;; (ioctlsocket socket FIONBIO mode)))
|