X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-simple-streams%2Ffile.lisp;h=5fd3d7098ed0e9ac9e8435395e358299c356e84e;hb=095564c28a259002c7e34fd1d861f5bbd0a959b6;hp=56ec6ecd615f608d0f81e76b03b607e86d663df1;hpb=cc9a73604f696b6e69842a95b1e11f40f8cdd7bf;p=sbcl.git diff --git a/contrib/sb-simple-streams/file.lisp b/contrib/sb-simple-streams/file.lisp index 56ec6ec..5fd3d70 100644 --- a/contrib/sb-simple-streams/file.lisp +++ b/contrib/sb-simple-streams/file.lisp @@ -210,7 +210,7 @@ (sb-ext:cancel-finalization stream) (error "Error fstating ~S: ~A" stream (sb-int:strerror dev))) - (when (> size most-positive-fixnum) + (when (>= size most-positive-fixnum) ;; Or else BUF-LEN has to be a general integer, or ;; maybe (unsigned-byte 32). In any case, this means ;; BUF-MAX and BUF-PTR have to be the same, which means @@ -219,7 +219,7 @@ ;; bigger files, anyway. Maybe DEVICE-READ can adjust ;; the mapped portion of the file when necessary? (warn "Unable to memory-map entire file.") - (setf size most-positive-fixnum)) + (setf size (1- most-positive-fixnum))) (let ((buffer (handler-case (sb-posix:mmap nil size prot sb-posix::MAP-SHARED fd 0) @@ -256,14 +256,12 @@ (sb-unix:unix-close (or (sm input-handle stream) (sm output-handle stream)))) t) -;; TODO: implement msync in sb-posix; activate this -#+paul (defmethod device-write ((stream mapped-file-simple-stream) buffer start end blocking) (assert (eq buffer :flush) (buffer)) ; finish/force-output (with-stream-class (mapped-file-simple-stream stream) - (unix:unix-msync (sm buffer stream) (sm buf-len stream) - (if blocking unix:ms_sync unix:ms_async)))) + (sb-posix:msync (sm buffer stream) (sm buf-len stream) + (if blocking sb-posix::ms-sync sb-posix::ms-async)))) (defmethod device-open ((stream probe-simple-stream) options) (let ((pathname (getf options :filename)))