Subject: Re: bug#27782: mmap for guile

From: Nala Ginrut <[email-masked]>
Date: Sun, 26 Nov 2017 00:17:11 +0800

Actually I've been using a FFI version of mmap in my working code, with my
previous patch to Guile it's very easy to handle errno. Just few lines code
is enough to bind mmap.
I am not sure if C version binding is still the best option to maintain.

2017年11月25日 22:42，"Matt Wette" <[email-masked]>写道：

> here is a start on test-suite/tests/mmap.test
>
> +;;;; mmap.test --- test suite for Guile's mmap functions  -*- scheme -*-
> +;;;;
> +
> +(define-module (test-mmap)
> +  #:use-module (test-suite lib))
> +
> +(use-modules (rnrs bytevectors))
> +
> +(with-test-prefix "mmap"
> +
> +  (pass-if "basics"
> +    (let* ((siz #x10000)
> +          (reg (mmap 0 siz)))
> +      (and (eqv? (bytevector-length reg) siz)
> +          (begin (bytevector-u8-set! reg 0 99)
> +                 (eqv? (bytevector-u8-ref reg 0) 99))
> +          (begin (bytevector-u8-set! reg (1- siz) 98)
> +                 (eqv? (bytevector-u8-ref reg (1- siz)) 98))
> +          #t)))
> +
> +  )
> +
> +;;;; --- last line ---
>
>
>
>
>