[Shards-general] FFI version of io-extra
normalperson at yhbt.net
Wed Mar 7 09:09:40 UTC 2012
Daniel Berger <djberg96 at gmail.com> wrote:
> Hi folks,
> Just for kicks, and to see what would happen with JRuby, I've created
> an ffi branch for io-extra. It's mostly done, though I have a few test
> failures (currently commented out) that I'm hoping to resolve.
F_GETFD = 1 # Get file descriptor flags
F_GETFL = 3 # Get file flags
F_SETFL = 4 # Set file flags
You should be able to get the F_* constants from the standard fcntl
extension (no idea if JRuby supports that ext) though.
O_DIRECT = 00040000 # Direct disk access hint
Ruby 1.9.3 defines IO::DIRECT already.
# Used by the writev method.
class Iovec < FFI::Struct
layout(:iov_base, :pointer, :iov_len, :int)
I'm not familiar with FFI, but :iov_len being :int doesn't look right.
iov_len should be size_t (8 bytes on 64-bit), int is only 4 bytes.
Given all the issues of FFI (many of which you've written about :), I
don't think it's worth the effort. I've never been interested in
supporting JRuby/JVM, though.
More information about the shards-general