Commit bbdc6143 authored by John Fremlin's avatar John Fremlin Committed by Stelian Ionescu
Browse files

Add mremap() on Linux.

parent 891bdbd1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -208,6 +208,7 @@
   ;; Platform-specific Functions

   #+linux #:fdatasync
   #+linux #:mremap

   ;; Constants

@@ -237,6 +238,9 @@
   #:map-anon #:map-hassemaphore #:map-inherit #:map-nocore #:map-nosync
   #:map-stack

   #+linux #:mremap-maymove
   #+linux #:mremap-fixed

   #:ms-async #:ms-sync #:ms-invalidate

   #:mcl-current #:mcl-future
+6 −0
Original line number Diff line number Diff line
@@ -148,6 +148,12 @@
  (constant (map-nosync "MAP_NOSYNC"))
  (constant (map-stack "MAP_STACK")))

;;; mremap()
#+linux
(progn
  (constant (mremap-maymove "MREMAP_MAYMOVE"))
  (constant (mremap-fixed "MREMAP_FIXED")))

;;; msync()
(constant (ms-async "MS_ASYNC") :documentation "msync: return immediately")
(constant (ms-sync "MS_SYNC")
+8 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
(define "_LARGEFILE_SOURCE")
(define "_LARGEFILE64_SOURCE")
(define "_FILE_OFFSET_BITS" 64)
(define "_GNU_SOURCE")
(c "#endif")

(include "string.h" "errno.h"  "sys/types.h" "sys/stat.h"
@@ -66,6 +67,13 @@
  (fd ("int" file-descriptor-designator))
  (offset ("off_t" off)))

#+linux
(defwrapper "mremap" ("void*" (errno-wrapper :pointer))
  (old-address :pointer)
  (old-size ("size_t" size))
  (new-size ("size_t" size))
  (flags :int))

(defwrapper ("stat" %stat) ("int" (errno-wrapper :int))
  (file-name ("const char*" filename-designator))
  (buf ("struct stat*" :pointer)))