7 Feb 16:05
integer fd filedescriptor / mapping special files
Christopher Friedt <chrisfriedt <at> gmail.com>
2012-02-07 15:05:37 GMT
2012-02-07 15:05:37 GMT
Hi list - I've been using this patch for years to a) allow access to the integer file descriptor in jni as in [1], and b) to use the FileChannel.map() method to map special files under linux using jamvm / classpath-0.98 (e.g. /dev/fb0). Thought I would submit it to the list for inclusion in any new releases. Feedback from any people wanting to validate is welcome. If I recall correctly, one shortcoming is that the returned mapped byte buffer is not 'direct'. Getting a direct map would require some manipulation of fields in an underlying byte[] somewhere. Obviously, a direct-mapped byte buffer would be more ideal. I think that requires using some kind of Unsafe class somewhere, and I stopped at that point. I don't mind doing the legwork for a direct mapped byte buffer too, to make it for inclusion in the next release. C [1] http://www.kfu.com/~nsayer/Java/jni-filedesc.html
diff --git a/gnu/java/nio/FileChannelImpl.java b/gnu/java/nio/FileChannelImpl.java
index d4a374b..06fa205 100644
--- a/gnu/java/nio/FileChannelImpl.java
+++ b/gnu/java/nio/FileChannelImpl.java
@@ -176,7 +176,7 @@ public final class FileChannelImpl extends FileChannel
*
(Continue reading)
RSS Feed