From: Rudi Schlatte Date: Sun, 7 Sep 2003 15:24:00 +0000 (+0000) Subject: sb-posix: define msync and its constants X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=962663e2cce358e9ba991d168256ea8855c17c46;p=sbcl.git sb-posix: define msync and its constants ... use it in sb-simple-streams --- diff --git a/contrib/sb-posix/TODO b/contrib/sb-posix/TODO index 75d62ad..3d6d814 100644 --- a/contrib/sb-posix/TODO +++ b/contrib/sb-posix/TODO @@ -16,7 +16,7 @@ getpeername getpriority getrlimit getrusage getsockname getsockopt gettimeofday gtty idle init_module ioctl ioctl_list ioperm iopl listen llseek lock lseek lstat madvise mincore mknod mlock mlockall modify_ldt mount mprotect mpx mremap msgctl msgget msgop msgrcv msgsnd -msync munlock munlockall nanosleep nice open pause pipe poll +munlock munlockall nanosleep nice open pause pipe poll prctl pread prof profil pselect ptrace pwrite query_module quotactl read readlink readv reboot recv recvfrom recvmsg rename rmdir sbrk sched_get_priority_max sched_get_priority_min sched_getparam diff --git a/contrib/sb-posix/constants.lisp b/contrib/sb-posix/constants.lisp index 052a734..847a5f6 100644 --- a/contrib/sb-posix/constants.lisp +++ b/contrib/sb-posix/constants.lisp @@ -90,6 +90,11 @@ (:integer map-private "MAP_PRIVATE" "mmap: private mapping") (:integer map-fixed "MAP_FIXED" "mmap: map at given location") + ;; msync() + (:integer ms-async "MS_ASYNC" "msync: return immediately") + (:integer ms-sync "MS_SYNC" "msync: perform synchronous writes") + (:integer ms-invalidate "MS_INVALIDATE" "msync: invalidate all cached data") + ;; opendir() (:structure dirent ("struct dirent" diff --git a/contrib/sb-posix/interface.lisp b/contrib/sb-posix/interface.lisp index 1a0bd29..4abe103 100644 --- a/contrib/sb-posix/interface.lisp +++ b/contrib/sb-posix/interface.lisp @@ -84,7 +84,7 @@ (pid sb-posix::pid-t) (pgid sb-posix::pid-t)) (define-call "setpgrp" int minusp) -;;; mmap +;;; mmap, msync (define-call "mmap" sb-sys:system-area-pointer ;; KLUDGE: #XFFFFFFFF is (void *)-1, which is the charming return ;; value of mmap on failure. Except on 64 bit systems ... @@ -96,5 +96,8 @@ (define-call "munmap" int minusp (start sb-sys:system-area-pointer) (length unsigned)) +(define-call "msync" int minusp + (addr sb-sys:system-area-pointer) (length unsigned) (flags int)) + (define-call "getpagesize" int minusp) diff --git a/contrib/sb-simple-streams/file.lisp b/contrib/sb-simple-streams/file.lisp index 56ec6ec..22099af 100644 --- a/contrib/sb-simple-streams/file.lisp +++ b/contrib/sb-simple-streams/file.lisp @@ -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))) diff --git a/version.lisp-expr b/version.lisp-expr index d97ab57..3685f44 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.3.41" +"0.8.3.42"