Try the following definition of unix-mmap (for
unix-glibc2.lisp, which
includes linux)
(in-package "UNIX")
(defun unix-mmap (addr length prot flags fd offset)
(declare (type (or null system-area-pointer) addr)
(type (unsigned-byte 32) length)
(type (integer 1 7) prot)
(type (unsigned-byte 32) flags)
(type (or null unix-fd) fd)
(type (signed-byte 32) offset))
;; Can't use syscall, because the address that is returned
could be
;; "negative". Hence we explicitly check for
mmap returning
;; MAP_FAILED.
(let ((result
(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 (<= (sys:SAP-INT result) 0)
(values nil (unix-errno))
result)))
|