Re: patch for mmap and friends

2023-01-14 Thread Matt Wette
On 1/14/23 2:42 PM, Maxime Devos wrote:     {   /* Use the fd of the port under clobber protection from concurrency. As scm_dynwind_acquire_port assumes that FILE is a port, check that first. */   SCM_VALIDATE_PORT (SCM_ARG5, file);   scm_dynwind_acquire_port (fil

Re: patch for mmap and friends

2023-01-14 Thread Maxime Devos
On 14-01-2023 23:08, Matt Wette wrote: 2) had to copy/modify dynwind_acquire_port and release_port from ports.c Is it because of the 'static' qualifier? If so, you could use the 'SCM_INTERNAL [...] scm_i_[...]' pattern, e.g. see 'scm_i_is_mutable_bitvector' in libguile/bitvectors.h and li

Re: patch for mmap and friends

2023-01-14 Thread Matt Wette
On 1/14/23 8:31 AM, Matt Wette wrote: On 1/14/23 7:18 AM, Maxime Devos wrote: \ Port objects should be accepted too, as previously asked on . As implied by later comments, using a raw fd causes problems with 'move->fdes'.  Fo

Re: patch for mmap and friends

2023-01-14 Thread tomas
On Sat, Jan 14, 2023 at 04:18:58PM +0100, Maxime Devos wrote: [...] > (While it is recommended for Scheme code to keep a reference to the port to > manually close afterwards, to free resources faster than waiting for GC, it > is not actually required.) Oh, oh. I've got a little anecdote to share

Re: patch for mmap and friends

2023-01-14 Thread Matt Wette
On 1/14/23 7:18 AM, Maxime Devos wrote: \ Port objects should be accepted too, as previously asked on . As implied by later comments, using a raw fd causes problems with 'move->fdes'.  For the remaining response, I'll assume t

Re: patch for mmap and friends

2023-01-14 Thread Maxime Devos
On 14-01-2023 01:49, Matt Wette wrote: Please consider this patch for adding mmap(), munmap() and msync()  to libguile/filesys.c.  Included is update for posix.texi and test file mman.test. Once included, feature 'mman should be #t. Matt + if (SCM_UNBNDP (fd)) +c_fd = -1; + else

Re: patch for mmap and friends

2023-01-13 Thread Matt Wette
On 1/13/23 4:49 PM, Matt Wette wrote: Please consider this patch for adding mmap(), munmap() and msync()  to libguile/filesys.c.  Included is update for posix.texi and test file mman.test. Once included, feature 'mman should be #t. Matt Please add the attached file: test-suite/tests/mman.test