(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))
SBCL itself"
:use ("CL" "SB!ALIEN" "SB!EXT" "SB!INT" "SB!SYS")
:export ("BOOL"
- "DWORD" "FD-CLEAR-INPUT" "FD-LISTEN"
- "FLUSH-CONSOLE-INPUT-BUFFER" "FORMAT-MESSAGE"
- "GET-LAST-ERROR" "GET-OSFHANDLE" "HANDLE"
- "HANDLE-CLEAR-INPUT" "HANDLE-LISTEN" "INT-PTR"
- "INVALID-HANDLE" "MILLISLEEP" "PEEK-CONSOLE-INPUT"
- "PEEK-NAMED-PIPE" "READ-FILE" "WRITE-FILE"
- "WITH-PROCESS-TIMES" "GET-VERSION-EX")))
+ "CLOSE-HANDLE"
+ "CREATE-FILE-MAPPING"
+ "DWORD"
+ "FD-CLEAR-INPUT"
+ "FD-LISTEN"
+ "FLUSH-CONSOLE-INPUT-BUFFER"
+ "FLUSH-VIEW-OF-FILE"
+ "FORMAT-MESSAGE"
+ "GET-LAST-ERROR"
+ "GET-OSFHANDLE"
+ "GET-VERSION-EX"
+ "HANDLE"
+ "HANDLE-CLEAR-INPUT"
+ "HANDLE-LISTEN"
+ "INT-PTR"
+ "INVALID-HANDLE"
+ "MAP-VIEW-OF-FILE"
+ "MILLISLEEP"
+ "PEEK-CONSOLE-INPUT"
+ "PEEK-NAMED-PIPE"
+ "READ-FILE"
+ "UNMAP-VIEW-OF-FILE"
+ "WRITE-FILE"
+ "WITH-PROCESS-TIMES")))
(setf aname (make-system-buffer length))
(alien-funcall afunc aname (addr length))))
(cast-and-free aname))))
+
+;; File mapping support routines
+(define-alien-routine (#!+sb-unicode "CreateFileMappingW"
+ #!-sb-unicode "CreateFileMappingA"
+ create-file-mapping)
+ handle
+ (handle handle)
+ (security-attributes (* t))
+ (protection dword)
+ (maximum-size-high dword)
+ (maximum-size-low dword)
+ (name (c-string #!+sb-unicode #!+sb-unicode :external-format :ucs-2)))
+
+(define-alien-routine ("MapViewOfFile" map-view-of-file)
+ system-area-pointer
+ (file-mapping handle)
+ (desired-access dword)
+ (offset-high dword)
+ (offset-low dword)
+ (size dword))
+
+(define-alien-routine ("UnmapViewOfFile" unmap-view-of-file) bool
+ (address (* t)))
+
+(define-alien-routine ("FlushViewOfFile" flush-view-of-file) bool
+ (address (* t))
+ (length dword))
+
+(define-alien-routine ("CloseHandle" close-handle) bool
+ (handle handle))
strerror(42);
write(0, 0, 0);
RtlUnwind(0, 0, 0, 0);
+ MapViewOfFile(0,0,0,0,0);
+ UnmapViewOfFile(0);
+ FlushViewOfFile(0,0);
#ifndef LISP_FEATURE_SB_UNICODE
CreateDirectoryA(0,0);
+ CreateFileMappingA(0,0,0,0,0,0);
GetComputerNameA(0, 0);
GetCurrentDirectoryA(0,0);
GetEnvironmentVariableA(0, 0, 0);
SetEnvironmentVariableA(0, 0);
#else
CreateDirectoryW(0,0);
+ CreateFileMappingW(0,0,0,0,0,0);
FormatMessageW(0, 0, 0, 0, 0, 0, 0);
GetComputerNameW(0, 0);
GetCurrentDirectoryW(0,0);