From: Daniel B. <da...@te...> - 2004-02-16 22:32:17
|
I noticed this while stracing an application: given a fully buffered bidirectional binary stream, if there is data in a buffer waiting to be read then sbcl outputs two lseek() system calls for each element output. Compile (defun socket-connect (port host) (sb-bsd-sockets:socket-make-stream (let ((s (make-instance 'sb-bsd-sockets:inet-socket :type :stream :protocol :tcp)) (num (car (sb-bsd-sockets:host-ent-addresses (sb-bsd-sockets:get-host-by-name host))))) (sb-bsd-sockets:socket-connect s num port) s) :buffering :full :element-type '(unsigned-byte 8) :input t :output t)) then attach strace, or whatever system call tracer is available on your platform, and evaluate the following form: (let ((f (socket-connect 119 "localhost"))) (prog1 (read-byte f) (write-sequence (map 'vector #'char-code (format nil "help~%")) f) (sleep 4) (close f))) I see ten lseek() calls. This appears to be due to the (file-position stream (file-position stream)) changes in 0.8.6.13 which are supposed to deconfuse bidi streams about their file-position. I'm going to think a little about how to fix this without killing that, but if anyone gets to it before I do it'd be much appreciated -dan -- "please make sure that the person is your friend before you confirm" |