X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ffd-stream.lisp;h=a759017fbb199814738ebfbbf6ac985127d885a1;hb=4d0b87793a047baecf2403455ddca1a82f44a41b;hp=54c7c51359b3ca998706f7013d7593d3a6cf95f9;hpb=4fa1c71c7dfa5c6d361304321cc67069a6410694;p=sbcl.git diff --git a/src/code/fd-stream.lisp b/src/code/fd-stream.lisp index 54c7c51..a759017 100644 --- a/src/code/fd-stream.lisp +++ b/src/code/fd-stream.lisp @@ -157,6 +157,8 @@ (element-type 'base-char) ;; the Unix file descriptor (fd -1 :type fixnum) + ;; What do we know about the FD? + (fd-type :unknown :type keyword) ;; controls when the output buffer is flushed (buffering :full :type (member :full :line :none)) ;; controls whether the input buffer must be cleared before output @@ -970,11 +972,9 @@ (count 0)) (tagbody ;; Check for blocking input before touching the stream if we are to - ;; serve events: if the FD is blocking, we don't want to hang on the - ;; write if we are to serve events or notice timeouts. - (if (and (or (fd-stream-serve-events stream) - (fd-stream-timeout stream) - *deadline*) + ;; serve events: if the FD is blocking, we don't want to try an uninterruptible + ;; read(). Regular files should never block, so we can elide the check. + (if (and (neq :regular (fd-stream-fd-type stream)) (sysread-may-block-p stream)) (go :wait-for-input) (go :main)) @@ -2217,6 +2217,12 @@ ((not (or input output)) (error "File descriptor must be opened either for input or output."))) (let ((stream (%make-fd-stream :fd fd + :fd-type (progn + #!-win32 (sb!unix:fd-type fd) + ;; KLUDGE. + #!+win32 (if serve-events + :unknown + :regular)) :name name :file file :original original