From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Nala Ginrut Newsgroups: gmane.lisp.guile.bugs Subject: bug#27782: mmap for guile Date: Sun, 26 Nov 2017 00:17:11 +0800 Message-ID: References: <3F4AACD7-3278-4C4B-90D4-56BCDE5043F6@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c05528275b515055ed100e2" X-Trace: blaine.gmane.org 1511626695 32383 195.159.176.226 (25 Nov 2017 16:18:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 25 Nov 2017 16:18:15 +0000 (UTC) Cc: 27782@debbugs.gnu.org To: Matt Wette Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Nov 25 17:18:10 2017 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eId9d-00082L-GU for guile-bugs@m.gmane.org; Sat, 25 Nov 2017 17:18:09 +0100 Original-Received: from localhost ([::1]:53605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eId9k-0005k7-Fb for guile-bugs@m.gmane.org; Sat, 25 Nov 2017 11:18:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eId9a-0005id-0G for bug-guile@gnu.org; Sat, 25 Nov 2017 11:18:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eId9W-0006AN-S9 for bug-guile@gnu.org; Sat, 25 Nov 2017 11:18:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49390) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eId9W-00069o-Mx for bug-guile@gnu.org; Sat, 25 Nov 2017 11:18:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eId9W-0004FL-B1 for bug-guile@gnu.org; Sat, 25 Nov 2017 11:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Nala Ginrut Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 25 Nov 2017 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27782 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 27782-submit@debbugs.gnu.org id=B27782.151162664016269 (code B ref 27782); Sat, 25 Nov 2017 16:18:02 +0000 Original-Received: (at 27782) by debbugs.gnu.org; 25 Nov 2017 16:17:20 +0000 Original-Received: from localhost ([127.0.0.1]:58071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eId8p-0004EL-Nw for submit@debbugs.gnu.org; Sat, 25 Nov 2017 11:17:19 -0500 Original-Received: from mail-yb0-f182.google.com ([209.85.213.182]:46256) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eId8o-0004E5-Ji for 27782@debbugs.gnu.org; Sat, 25 Nov 2017 11:17:18 -0500 Original-Received: by mail-yb0-f182.google.com with SMTP id 188so9172351ybd.13 for <27782@debbugs.gnu.org>; Sat, 25 Nov 2017 08:17:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NHOzK0j8hlT/jzVuIsjgBOgyUClJ+UXobU6BRM9CIGY=; b=NMlyw4Q5FTKVrOuLvKom/o7sMw5PVGxIPmiVDhFCaVt8CP2RdE/gtXe75V6oiVikrN VDcbuCt1LhPVn20dINxsdYlSXXEHUj7jSJXuUjqYJB6AJl2s+BO3Xm1l2JRLfRYYKJR0 uO2bjrg5lUduO4y3bdrGIY/2io3hn4Lsn1xGPevCXhARyeohW/724fpWf+WnWaJeUyuV breft0WI34fk5+YKU/sN4VER+KmeJjT87j2+dgQipCua0bqWdDuSYOQ4cHKVJC1hgMwP Xz4iAgHblPPQBthB0xTupxR+IIPV01ZrDZ/pw6+PifrZKmgTYNJcyEbBHwtu0a6SyU8B n63A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NHOzK0j8hlT/jzVuIsjgBOgyUClJ+UXobU6BRM9CIGY=; b=qMZmd/elSLhS7GDTD+QbcUr9FoV32/HR+4LGxB44cAkIJu72iVQP/U1k8LHc0acR5t QKI1GNaM3/TA/2T10Ta8cXbEEW5/mLKyxPBBVtAgvL/8drSD8W4nkiCktQI8gQsMKaLA 9hDSnz6nbA3ETBLNumjhat4TKB+L5z8q2Ztgy6PgMugxgVAM7ThItLcUnDH3/BNOGuH6 uw/l6rsEGVelgy99hpWd2NDiFCOkD6yU03GHRfg9EQ8kS3T6p9CaSn3W32205QtJAdYl TXkrD/4wKQ7b9+JnEW+sx0sn9br7VPP8/EaYEtu9bXDSy+2AvzWc2MXm6DALbJv6qvDN upiA== X-Gm-Message-State: AJaThX4yYU+3MhpLmrxuU9RNfG2Av/7oVxyLBI/fCFZai9QCwKKcshYN wrSs2SJEZrqzETGY1bFQ+AA3wOZbVQkWJ6yfvls= X-Google-Smtp-Source: AGs4zMZdNb8zl195qSmR+BsiNw7aUN5ySNpSbUPJPZ5P9MBigoRvZ/X/K/NPp6DXNCvsmqOGnzkSAEQV9mKAMC1jpcE= X-Received: by 10.37.193.7 with SMTP id r7mr19741467ybf.205.1511626632441; Sat, 25 Nov 2017 08:17:12 -0800 (PST) Original-Received: by 10.37.45.94 with HTTP; Sat, 25 Nov 2017 08:17:11 -0800 (PST) Original-Received: by 10.37.45.94 with HTTP; Sat, 25 Nov 2017 08:17:11 -0800 (PST) In-Reply-To: <3F4AACD7-3278-4C4B-90D4-56BCDE5043F6@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8915 Archived-At: --94eb2c05528275b515055ed100e2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=E5=B9=B411=E6=9C=8825=E6=97=A5 22:42=EF=BC=8C"Matt Wette" =E5=86=99=E9=81=93=EF=BC=9A > 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 --- > > > > > --94eb2c05528275b515055ed100e2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 no= t sure if C version binding is still the best option to maintain.

2017=E5=B9=B411= =E6=9C=8825=E6=97=A5 22:42=EF=BC=8C"Matt Wette" <matt.wette@gmail.com>=E5=86=99=E9=81=93= =EF=BC=9A
here is = a start on test-suite/tests/mmap.test

+;;;; mmap.test --- test suite for Guile's mmap functions=C2=A0 -*- sch= eme -*-
+;;;;
+
+(define-module (test-mmap)
+=C2=A0 #:use-module (test-suite lib))
+
+(use-modules (rnrs bytevectors))
+
+(with-test-prefix "mmap"
+
+=C2=A0 (pass-if "basics"
+=C2=A0 =C2=A0 (let* ((siz #x10000)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (reg (mmap 0 siz)))
+=C2=A0 =C2=A0 =C2=A0 (and (eqv? (bytevector-length reg) siz)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (begin (bytevector-u8-set! reg 0 99) +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(eqv? (bytev= ector-u8-ref reg 0) 99))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (begin (bytevector-u8-set! reg (1- siz)= 98)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(eqv? (bytev= ector-u8-ref reg (1- siz)) 98))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #t)))
+
+=C2=A0 )
+
+;;;; --- last line ---




--94eb2c05528275b515055ed100e2--