[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Feature Request] Some ideas on 'mmap'
From: |
Nala Ginrut |
Subject: |
Re: [Feature Request] Some ideas on 'mmap' |
Date: |
Thu, 02 May 2013 17:44:51 +0800 |
Here's the implementation in Artanis, and all the constant like
PROT_READ definition are ignored:
------------------ code -----------------
(define *libc-ffi* (dynamic-link))
(define %mmap
(pointer->procedure '*
(dynamic-func "mmap" *libc-ffi*)
(list '* size_t int int int size_t)))
(define %munmap
(pointer->procedure int
(dynamic-func "munmap" *libc-ffi*)
(list '* size_t)))
(define* (mmap size #:key (addr %null-pointer) (fd -1)
(prot MAP_SHARED) (flags PROT_READ) (offset 0))
(pointer->bytevector (%mmap addr size prot flags fd offset) size))
(define (munmap bv size)
(%munmap (bytevector->pointer bv size) size))
-------------------------end-----------------------------
Comments?
Thanks!