sb-posix: define msync and its constants
authorRudi Schlatte <rudi@constantly.at>
Sun, 7 Sep 2003 15:24:00 +0000 (15:24 +0000)
committerRudi Schlatte <rudi@constantly.at>
Sun, 7 Sep 2003 15:24:00 +0000 (15:24 +0000)
        ... use it in sb-simple-streams

contrib/sb-posix/TODO
contrib/sb-posix/constants.lisp
contrib/sb-posix/interface.lisp
contrib/sb-simple-streams/file.lisp
version.lisp-expr

index 75d62ad..3d6d814 100644 (file)
@@ -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
index 052a734..847a5f6 100644 (file)
  (: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"
index 1a0bd29..4abe103 100644 (file)
@@ -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)
 
index 56ec6ec..22099af 100644 (file)
     (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)))
index d97ab57..3685f44 100644 (file)
@@ -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"