chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Memory mapped I/O and CHICKEN ports


From: Thomas Chust
Subject: Re: [Chicken-users] Memory mapped I/O and CHICKEN ports
Date: Mon, 06 Dec 2004 15:04:58 +0100
User-agent: Mozilla Thunderbird 0.8 (X11/20040913)

felix winkelmann wrote:
[...]
In that case I'd do everything by hand:

#>?
___declare(rename, "write;fd_write")
int write(int fd, void *buf, int count);
<#

(use posix)

(define fdin (file-open "input" open/read))
(define size (file-size fdin))
(define mmap (map-file-to-memory #f size prot/read map/private fdin))
(define fdout (file-open "output" (+ open/creat open/write)))
(print (fd_write fdout (memory-mapped-file-pointer mmap) size))
(file-close fdout)

If you want to write out the file with standard display/write/whatever,
then we probably would have to hack the internal printer stuff.
[...]

Hello,

the reason why I wanted to use the standard display routines instead of a direct syscall interface is that I have an encryption layer built into a custom output port that i'd like to use. So I think I'll probably stick with just reading/sending the file blockwise -- it's not worth the trouble to hack the internals of CHICKEN for a small speed improvement with large files and it's neither worth the trouble to rewrite all the multithreaded I/O logic and crypto layer in a different way to allow for writing data from raw buffers.

Ciao,
Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]