From 6e324d3127649197c0bc76bdb65d1ec6db0c0312 Mon Sep 17 00:00:00 2001 From: cshapiro <cshapiro> Date: Tue, 6 Nov 2007 07:16:05 +0000 Subject: [PATCH] Type mmap as returning a system area pointer to accommodate pointers above 2GB. Also, always return the second value. This makes the type signature of unix-mmap consistent with other system calls. --- code/unix-glibc2.lisp | 11 ++++++----- code/unix.lisp | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/code/unix-glibc2.lisp b/code/unix-glibc2.lisp index bc99ac208..039e21e86 100644 --- a/code/unix-glibc2.lisp +++ b/code/unix-glibc2.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix-glibc2.lisp,v 1.39 2007/11/06 06:04:56 cshapiro Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix-glibc2.lisp,v 1.40 2007/11/06 07:16:05 cshapiro Exp $") ;;; ;;; ********************************************************************** ;;; @@ -246,7 +246,7 @@ (defconstant ms_invalidate 2) ;; The return value from mmap that means mmap failed. -(defconstant map_failed -1) +(defconstant map_failed (int-sap (1- (ash 1 vm:word-bits)))) (defun unix-mmap (addr length prot flags fd offset) (declare (type (or null system-area-pointer) addr) @@ -259,12 +259,13 @@ ;; "negative". Hence we explicitly check for mmap returning ;; MAP_FAILED. (let ((result - (alien-funcall (extern-alien "mmap" (function int system-area-pointer + (alien-funcall (extern-alien "mmap" (function system-area-pointer + system-area-pointer size-t int int int off-t)) (or addr +null+) length prot flags (or fd -1) offset))) - (if (= result map_failed) + (if (sap= result map_failed) (values nil (unix-errno)) - (sys:int-sap result)))) + (values result 0)))) (defun unix-munmap (addr length) (declare (type system-area-pointer addr) diff --git a/code/unix.lisp b/code/unix.lisp index 09f9f416c..c53b11baf 100644 --- a/code/unix.lisp +++ b/code/unix.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix.lisp,v 1.114 2007/11/06 06:04:56 cshapiro Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix.lisp,v 1.115 2007/11/06 07:16:05 cshapiro Exp $") ;;; ;;; ********************************************************************** ;;; @@ -1056,7 +1056,7 @@ (defconstant ms_invalidate 2) ;; The return value from mmap that means mmap failed. -(defconstant map_failed -1) +(defconstant map_failed (int-sap (1- (ash 1 vm:word-bits)))) (defun unix-mmap (addr length prot flags fd offset) (declare (type (or null system-area-pointer) addr) @@ -1069,12 +1069,13 @@ ;; "negative". Hence we explicitly check for mmap returning ;; MAP_FAILED. (let ((result - (alien-funcall (extern-alien "mmap" (function int system-area-pointer + (alien-funcall (extern-alien "mmap" (function system-area-pointer + system-area-pointer size-t int int int off-t)) (or addr +null+) length prot flags (or fd -1) offset))) - (if (= result map_failed) + (if (sap= result map_failed) (values nil (unix-errno)) - (sys:int-sap result)))) + (values result 0)))) (defun unix-munmap (addr length) (declare (type system-area-pointer addr) -- GitLab