Hi, On Fri, 2007-07-20 at 14:02 +0200, Mark Wielaard wrote: > - Some of the work with our ByteBuffers is somewhat awkward since we > pretend everything is longs. But arrays in java cannot address anything > bigger than a (positive) int. So having offsets and lengths as longs is > somewhat cheating since it will never work in practise. So there is some > casting back and forth. Maybe just change the ByteBuffer methods that > work on arrays to just take ints for offset and length. The following patch does this for ByteBuffers, FileDescriptors and StatelessFile. Now it is possible to catch such issues during compile time instead of during runtime one day when some offset or length is bigger than what fits into an array. This makes implementing the methods that work on byte[] simpler and safer. It also fixes LogicalMemoryBuffer to not set the order explicitly, but lets the caller determine the order. frysk-core/frysk/proc/live/ChangeLog 2007-07-30 Mark Wielaard * AddressSpaceByteBuffer.java (Request): Make length and offset ints. (peek): Likewise. * LinuxTask.java (sendrecMemory): Set memory order. * LogicalMemoryBuffer.java (order): Remove field. (LogicalMemoryBuffer): Don't set order. (peek): Make length and offset ints. (subBuffer): Don't pass order. * MemorySpaceByteBuffer.java (Request): Make length and offset ints. (peek): Likewise. * TestMemorySpaceByteBuffer.java (AsyncPeeks): Make length int. frysk-sys/frysk/sys/ChangeLog 2007-07-30 Mark Wielaard * FileDescriptor.java (read): Make start and length ints. (write): Likewise. * Ptrace.java (peek): Make length and offset ints. * StatelessFile.java (pread): Make start and length ints. (pwrite): Likewise. * TestFileDescriptor.java (IO.op): Likewise. (assertArrayIndexOutOfBounds): Likewise. (testReadOutOfBounds): Likewise. (testWriteOutOfBounds): Likewise. * TestPtrace.java (verifyOutOfBounds): Make length and offset ints. * TestStatelessFile.java: Make start and length ints. * cni/Errno.cxx (verifyBounds): Make start and length ints. * cni/Errno.hxx: Likewise. * cni/FileDescriptor.cxx (read): Make start and length jints. (write): Likewise. * cni/Ptrace.cxx (peek): Make length and offset jints. * cni/StatelessFile.cxx (pread): Make start and length jints. (pwrite): Likewise. frysk-sys/inua/ChangeLog 2007-07-30 Mark Wielaard * eio/ByteBuffer.java (peek): Make off and len ints. (poke): Likewise. (peekFully): Likewise. (pokeFully): Likewise. * eio/MmapByteBuffer.java (peek): Likewise. * eio/cni/MmapByteBuffer.cxx (peek): Likewise. Tested on x86 and x86_64 without regressions. Cheers, Mark