X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-posix%2Finterface.lisp;h=f8eef1fdaadba2f0aba61895e89204fd7c24e8cd;hb=219cc40793f9c82fb943b29a1846f898f4f9de1e;hp=732922e08f10bc8338df1107963bfa7e6ffc3894;hpb=ffb003f5648f1abe64561c8a426878774e10a21b;p=sbcl.git diff --git a/contrib/sb-posix/interface.lisp b/contrib/sb-posix/interface.lisp index 732922e..f8eef1f 100644 --- a/contrib/sb-posix/interface.lisp +++ b/contrib/sb-posix/interface.lisp @@ -64,14 +64,19 @@ ((errno :initarg :errno :reader sb-posix:syscall-errno) (name :initarg :name :initform nil :reader sb-posix:syscall-name)) (:report (lambda (c s) - (let ((errno (sb-posix:syscall-errno c))) - (format s "Error in ~S: ~A (~A)" - (sb-posix:syscall-name c) - (sb-int:strerror errno) - errno))))) - -(declaim (ftype (function (symbol) nil) syscall-error)) -(defun syscall-error (name) + (let ((errno (sb-posix:syscall-errno c)) + (name (sb-posix:syscall-name c))) + (if name + (format s "Error in ~S: ~A (~A)" + name + (sb-int:strerror errno) + errno) + (format s "Error in syscall: ~A (~A)" + (sb-int:strerror errno) + errno)))))) + +(declaim (ftype (function (&optional symbol) nil) syscall-error)) +(defun syscall-error (&optional name) (error 'sb-posix:syscall-error :name name :errno (get-errno))) @@ -437,8 +442,29 @@ not supported." (define-call "munmap" int minusp (start sb-sys:system-area-pointer) (length unsigned)) +#-win32 (define-call "msync" int minusp (addr sb-sys:system-area-pointer) (length unsigned) (flags int))) +#+win32 +(progn + ;; No attempt is made to offer a full mmap-like interface on Windows. + ;; It would be possible to do so (and has been done by AK on his + ;; branch), but the use case is unclear to me. However, the following + ;; definitions are needed to keep existing code in sb-simple-streams + ;; running. --DFL + (defconstant PROT-READ #x02) + (defconstant PROT-WRITE #x04) + (defconstant PROT-EXEC #x10) + (defconstant PROT-NONE 0) + (defconstant MAP-SHARED 0) + (defconstant MAP-PRIVATE 1) + (defconstant MS-ASYNC nil) + (defconstant MS-SYNC nil) + (export ;export on the fly like define-call + (defun msync (address length flags) + (declare (ignore flags)) + (when (zerop (sb-win32:flush-view-of-file address length)) + (sb-win32::win32-error "FlushViewOfFile"))))) ;;; mlockall, munlockall (define-call "mlockall" int minusp (flags int))