From: Daniel Berger Date: 2009-08-04T03:01:34+09:00 Subject: Re: JRuby, ffi, bad file descriptor On Aug 3, 7:06 am, Charles Oliver Nutter wrote: > Ahhh. Yeah I see the problem. > > In JRuby, because we don't normally have access to the "real" file > descriptor for any IO channel, all our logic for fileno is basically > fake. We keep an artificial list of numbers that map to IO channels > and use that as our file descriptor table. In this case, you're > pulling in a real file descriptor from the system, which does not > exist in our table, so we raise an error. > > In order for us to support arbitrary descriptors in our IO we'd > probably need an implementation of IO that used all low-level C APIs > rather than Java IO APIs. There's currently no (public) way to get > from a file descriptor to an IO channel in Java APIs. Ok, that's unfortunate. > So I'll divert this issue by asking: what does this get you that our > built-in tempfile support does not? We do not use MRI's tempfile.rb; > we've implemented our own on top of Java's tempfile support that > performs quite a bit better. Perhaps there's a missing feature we can > add. Where is it? I looked through the source but didn't see it. > It would also be worth discussing this with Wayne Meissner. It would > certainly be *nice* if we could transparently support real file > descriptors, and he may know a way to do it. That would be good. :) Regards, Dan