Class LinuxFile

    • Method Detail

      • ioctl

        public void ioctl​(long command,
                          int value)
                   throws IOException
        Runs an ioctl value command on a file descriptor.
        Parameters:
        command - ioctl command
        value - int ioctl value
        Throws:
        IOException
      • ioctl

        public void ioctl​(long command,
                          ByteBuffer data,
                          IntBuffer offsets)
                   throws IOException
        Runs an ioctl on a file descriptor. Uses special offset buffer to produce real C-like structures with pointers. Advanced use only! Must be able to produce byte-perfect data structures just as gcc would on this system, including struct padding and pointer size. The data ByteBuffer uses the current position to determine the head point of data passed to the ioctl. This is useful for appending entry-point data structures at the end of the buffer, while referring to other structures/data that come before them in the buffer. When assembling the structured data, use wordSize to determine the size in bytes needed for a pointer. Also be sure to consider GCC padding and structure alignment. GCC will try a field to its word size (32b ints align at 4-byte, etc), and will align the structure size with the native word size (4-byte for 32b, 8-byte for 64b). Provided IntBuffer offsets must use native byte order (endianness).
         
            <NEED BETTER EXAMPLE HERE>
         
         
        DANGER: check your buffer length! The possible length varies depending on the ioctl call. Overruns are very possible. ioctl tries to determine EFAULTs, but sometimes you might trample JVM data if you are not careful.
        Parameters:
        command - ioctl command
        data - values in bytes for all structures, with 4 or 8 byte size holes for pointers
        offsets - byte offsets of pointer at given index
        Throws:
        IOException
      • errno

        public static int errno()
      • strerror

        public static String strerror​(int code)
      • directIOCTL

        protected static int directIOCTL​(int fd,
                                         long command,
                                         int value)
      • directIOCTLStructure

        protected static int directIOCTLStructure​(int fd,
                                                  long command,
                                                  ByteBuffer data,
                                                  int dataOffset,
                                                  IntBuffer offsetMap,
                                                  int offsetMapOffset,
                                                  int offsetCapacity)
      • getPosixFD

        protected static int getPosixFD​(FileDescriptor fileDescriptor)