From: Eleanor McHugh Date: 2009-08-03T23:41:40+09:00 Subject: Re: JRuby, ffi, bad file descriptor On 3 Aug 2009, at 14:06, 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. > > 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. > > 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. I'd be interested in support for that as well if it's possible: a lot of fun tricks on Unix platforms rely on misappropriating file descriptors and injecting them into IO objects. Ellie Eleanor McHugh Games With Brains http://slides.games-with-brains.net ---- raise ArgumentError unless @reality.responds_to? :reason