From 8a9a7ae2a692430b069b307a0993113f9f287229 Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Sun, 10 May 2015 09:43:23 -0700
Subject: [PATCH] unix-glibc2 needs unix-munmap.  prot_read is available for
 both.

---
 src/code/exports.lisp     | 10 ++--------
 src/code/unix-glibc2.lisp |  5 +++++
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/code/exports.lisp b/src/code/exports.lisp
index 9854535c3..c584eb043 100644
--- a/src/code/exports.lisp
+++ b/src/code/exports.lisp
@@ -284,7 +284,9 @@
 	   "FD-CLR"
 
 	   ;; Simple streams
+	   "PROT_READ"
 	   "UNIX-MMAP"
+	   "UNIX-MUNMAP"
 	   "UNIX-MSYNC"
 
 	   ;; Motif
@@ -313,10 +315,6 @@
 	   ;; run-program.lisp
 	   "SGTTYB"
 
-	   ;; Simple streams
-	   "PROT_READ"
-	   "UNIX-MUNMAP"
-
 	   ;; Other symbols from structures, etc.
 	   "C-CC"
 	   "C-CFLAG"
@@ -672,10 +670,6 @@
 	   ;; run-program.lisp
 	   "SGTTYB"
 
-	   ;; Simple streams
-	   "PROT_READ"
-	   "UNIX-MUNMAP"
-
 	   ;; Other symbols
 	   "BLKCNT-T"
 	   "C-CC"
diff --git a/src/code/unix-glibc2.lisp b/src/code/unix-glibc2.lisp
index 6f6a0955c..b9d4ce847 100644
--- a/src/code/unix-glibc2.lisp
+++ b/src/code/unix-glibc2.lisp
@@ -1036,6 +1036,11 @@
 	(values nil (unix-errno))
 	(values result 0))))
 
+(defun unix-munmap (addr length)
+  (declare (type system-area-pointer addr)
+	   (type (unsigned-byte 32) length))
+  (syscall ("munmap" system-area-pointer size-t) t addr length))
+
 (defun unix-msync (addr length flags)
   (declare (type system-area-pointer addr)
 	   (type (unsigned-byte 32) length)
-- 
GitLab