/[cmucl]/src/code/unix-glibc2.lisp
ViewVC logotype

Diff of /src/code/unix-glibc2.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.36 by rtoy, Mon Oct 10 20:31:13 2005 UTC revision 1.37 by rtoy, Sat Apr 7 15:05:52 2007 UTC
# Line 245  Line 245 
245  (defconstant ms_sync 4)  (defconstant ms_sync 4)
246  (defconstant ms_invalidate 2)  (defconstant ms_invalidate 2)
247    
248    ;; The return value from mmap that means mmap failed.
249    (defconstant map_failed -1)
250    
251  (defun unix-mmap (addr length prot flags fd offset)  (defun unix-mmap (addr length prot flags fd offset)
252    (declare (type (or null system-area-pointer) addr)    (declare (type (or null system-area-pointer) addr)
253             (type (unsigned-byte 32) length)             (type (unsigned-byte 32) length)
254             (type (integer 1 7) prot)             (type (integer 1 7) prot)
255             (type (unsigned-byte 32) flags)             (type (unsigned-byte 32) flags)
256             (type (or null unix-fd) fd)             (type (or null unix-fd) fd)
257             (type (signed-byte 32) offset))             (type file-offset offset))
258    (syscall ("mmap" system-area-pointer size-t int int int off-t)    ;; Can't use syscall, because the address that is returned could be
259             (sys:int-sap result)    ;; "negative".  Hence we explicitly check for mmap returning
260             (or addr +null+) length prot flags (or fd -1) offset))    ;; MAP_FAILED.
261      (let ((result
262             (alien-funcall (extern-alien "mmap" (function int system-area-pointer
263                                                           size-t int int int off-t))
264                            (or addr +null+) length prot flags (or fd -1) offset)))
265        (if (= result map_failed)
266            (values nil (unix-errno))
267            (sys:int-sap result))))
268    
269  (defun unix-munmap (addr length)  (defun unix-munmap (addr length)
270    (declare (type system-area-pointer addr)    (declare (type system-area-pointer addr)

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

  ViewVC Help
Powered by ViewVC 1.1.5