unix-bytestring v0.2.0 (Was: Re: Proposal: add ByteString support to unix:System.Posix.IO API)

wren ng thornton wren at freegeek.org
Mon Mar 7 12:38:04 CET 2011


On 3/6/11 10:19 PM, Tyson Whitehead wrote:
> On March 5, 2011 07:30:24 wren ng thornton wrote:
>> P.S., what the heck is readv(2) supposed to be good for? Does anyone
>> want to see a binding for it?
>
> Strikes me as something you might want to use in code that is orientated
> towards working with chunks of data of a possibly fixed maximum size (i.e., a
> chunk orientated steaming environment).
>
> The readv call gives you the ability to fill a series of chunks (e.g., from a
> free chunk list or something) with one call into the kernel.  This could be a
> significant improvement from being forced to fill them individually.

Doh. For some reason I overlooked the fact that each iovec carries its 
length, and was wondering how it "performs the same action, but scatters 
the input data into the @iovcnt@ buffers". Makes a bit more sense if 
it's just filling up a segmented buffer.

I might as well give a raw binding for it and think about what a decent 
non-raw version should look like.

-- 
Live well,
~wren



More information about the Libraries mailing list