Re: [Feature Request] Some ideas on 'mmap'

2013-05-02 Thread Nala Ginrut
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

Re: [Feature Request] Some ideas on 'mmap'

2013-05-01 Thread Nala Ginrut
On Wed, 2013-05-01 at 18:54 +0800, Chaos Eternal wrote: > but howto protect your pointer ? > There's no bared pointer after pointer->bytevector or wrapped with record-type. Anyway, since Guile can't operate pointers directly, so it's no need to compare with C about 'protect pointer'. > Also, mma

Re: [Feature Request] Some ideas on 'mmap'

2013-05-01 Thread Chaos Eternal
but howto protect your pointer ? Also, mmap-ed spaces can hardly be GCed, this will introduce extra complexities. still see no extra necessary in compare to ports. On Tue, Apr 30, 2013 at 10:23 PM, Nala Ginrut wrote: > On Tue, 2013-04-30 at 21:57 +0800, Daniel Hartwig wrote: >> On 30 April 2013

Re: [Feature Request] Some ideas on 'mmap'

2013-04-30 Thread Ian Price
There has been a lot of talk about the interface, but here's a simple idea: Post some examples of how you want to use it. We can all sit around and argue forever and a day about the API, but if you want it, you probably have some real-word examples in mind and if you don't, then that's a good rea

Re: [Feature Request] Some ideas on 'mmap'

2013-04-30 Thread Daniel Hartwig
On 30 April 2013 22:23, Nala Ginrut wrote: > But I still recommend that store 'size' & 'flags', which need a new > record-type and to write some helper functions, but very less code. And have you considered that you can munmap only some sections, how is that going to work with your proposed struc

Re: [Feature Request] Some ideas on 'mmap'

2013-04-30 Thread Noah Lavine
Hello, Apologies if this is well-known and I just forgot it, but can bytevectors be read-only? I think we'd need that to handle read-only mmap'ed memory. (If not, I hope we could allow read-only bytevectors.) Bytevectors include size, so there's no need to put that in a struct, but I'm not sure w

Re: [Feature Request] Some ideas on 'mmap'

2013-04-30 Thread Nala Ginrut
On Tue, 2013-04-30 at 21:57 +0800, Daniel Hartwig wrote: > On 30 April 2013 21:49, Nala Ginrut wrote: > > If I use bytevector instead, it means I have to read all the content > > from a file first. I don't think it's the same with mmap in POSIX. > > mmap is used for very large data I/O, if we deci

Re: [Feature Request] Some ideas on 'mmap'

2013-04-30 Thread Daniel Hartwig
On 30 April 2013 21:49, Nala Ginrut wrote: >> > 6. other helper functions also available: >> >> If you want a port, use a port. Likewise for strings, bytevectors. >> > > For an instance, in a multi-thread program, if we use port and need to > move the cursor, we have to remember/restore the curso

Re: [Feature Request] Some ideas on 'mmap'

2013-04-30 Thread Daniel Hartwig
On 30 April 2013 21:49, Nala Ginrut wrote: > If I use bytevector instead, it means I have to read all the content > from a file first. I don't think it's the same with mmap in POSIX. > mmap is used for very large data I/O, if we decide to read them all, we > lose the game. > mmap does lazy disk I/

Re: [Feature Request] Some ideas on 'mmap'

2013-04-30 Thread Nala Ginrut
On Tue, 2013-04-30 at 18:12 +0800, Daniel Hartwig wrote: > On 30 April 2013 17:27, Nala Ginrut wrote: > > hi guys! > > A discussion on IRC about adding 'mmap' raised, and I will share some > > ideas on this topic: > > > > 1. Complex one or simple one? > > The simple one is just a simple wrapper ta

Re: [Feature Request] Some ideas on 'mmap'

2013-04-30 Thread Daniel Hartwig
On 30 April 2013 17:27, Nala Ginrut wrote: > hi guys! > A discussion on IRC about adding 'mmap' raised, and I will share some > ideas on this topic: > > 1. Complex one or simple one? > The simple one is just a simple wrapper taking advantage of (system > foreign). > The complex one is more alike P

[Feature Request] Some ideas on 'mmap'

2013-04-30 Thread Nala Ginrut
hi guys! A discussion on IRC about adding 'mmap' raised, and I will share some ideas on this topic: 1. Complex one or simple one? The simple one is just a simple wrapper taking advantage of (system foreign). The complex one is more alike Python's mmap module. Contains a special type of , and a bun