Class NativeIO.POSIX

java.lang.Object
org.apache.hadoop.io.nativeio.NativeIO.POSIX
Enclosing class:
NativeIO

public static class NativeIO.POSIX extends Object
  • Field Details

    • O_RDONLY

      public static int O_RDONLY
    • O_WRONLY

      public static int O_WRONLY
    • O_RDWR

      public static int O_RDWR
    • O_CREAT

      public static int O_CREAT
    • O_EXCL

      public static int O_EXCL
    • O_NOCTTY

      public static int O_NOCTTY
    • O_TRUNC

      public static int O_TRUNC
    • O_APPEND

      public static int O_APPEND
    • O_NONBLOCK

      public static int O_NONBLOCK
    • O_SYNC

      public static int O_SYNC
    • POSIX_FADV_NORMAL

      public static int POSIX_FADV_NORMAL
    • POSIX_FADV_RANDOM

      public static int POSIX_FADV_RANDOM
    • POSIX_FADV_SEQUENTIAL

      public static int POSIX_FADV_SEQUENTIAL
    • POSIX_FADV_WILLNEED

      public static int POSIX_FADV_WILLNEED
    • POSIX_FADV_DONTNEED

      public static int POSIX_FADV_DONTNEED
    • POSIX_FADV_NOREUSE

      public static int POSIX_FADV_NOREUSE
    • SYNC_FILE_RANGE_WAIT_BEFORE

      public static int SYNC_FILE_RANGE_WAIT_BEFORE
    • SYNC_FILE_RANGE_WRITE

      public static int SYNC_FILE_RANGE_WRITE
    • SYNC_FILE_RANGE_WAIT_AFTER

      public static int SYNC_FILE_RANGE_WAIT_AFTER
    • fadvisePossible

      public static boolean fadvisePossible
    • MMAP_PROT_READ

      public static final int MMAP_PROT_READ
      See Also:
    • MMAP_PROT_WRITE

      public static final int MMAP_PROT_WRITE
      See Also:
    • MMAP_PROT_EXEC

      public static final int MMAP_PROT_EXEC
      See Also:
  • Constructor Details

    • POSIX

      public POSIX()
  • Method Details

    • getCacheManipulator

      public static NativeIO.POSIX.CacheManipulator getCacheManipulator()
    • setCacheManipulator

      public static void setCacheManipulator(NativeIO.POSIX.CacheManipulator cacheManipulator)
    • setPmdkSupportState

      public static void setPmdkSupportState(int stateCode)
    • getPmdkSupportStateMessage

      public static String getPmdkSupportStateMessage()
    • isPmdkAvailable

      public static boolean isPmdkAvailable()
    • isAvailable

      public static boolean isAvailable()
      Returns:
      Return true if the JNI-based native IO extensions are available.
    • open

      public static FileDescriptor open(String path, int flags, int mode) throws IOException
      Wrapper around open(2) .
      Parameters:
      path - input path.
      flags - input flags.
      mode - input mode.
      Returns:
      FileDescriptor.
      Throws:
      IOException - raised on errors performing I/O.
    • chmod

      public static void chmod(String path, int mode) throws IOException
      Throws:
      IOException
    • syncFileRangeIfPossible

      public static void syncFileRangeIfPossible(FileDescriptor fd, long offset, long nbytes, int flags) throws NativeIOException
      Call sync_file_range on the given file descriptor. See the manpage for this syscall for more information. On systems where this call is not available, does nothing.
      Parameters:
      fd - input fd.
      offset - input offset.
      nbytes - input nbytes.
      flags - input flag.
      Throws:
      NativeIOException - if there is an error with the syscall
    • munmap

      public static void munmap(MappedByteBuffer buffer)
      Unmaps the block from memory. See munmap(2). There isn't any portable way to unmap a memory region in Java. So we use the sun.nio method here. Note that unmapping a memory region could cause crashes if code continues to reference the unmapped code. However, if we don't manually unmap the memory, we are dependent on the finalizer to do it, and we have no idea when the finalizer will run.
      Parameters:
      buffer - The buffer to unmap.
    • getFstat

      public static NativeIO.POSIX.Stat getFstat(FileDescriptor fd) throws IOException
      Returns the file stat for a file descriptor.
      Parameters:
      fd - file descriptor.
      Returns:
      the file descriptor file stat.
      Throws:
      IOException - thrown if there was an IO error while obtaining the file stat.
    • getStat

      public static NativeIO.POSIX.Stat getStat(String path) throws IOException
      Return the file stat for a file path.
      Parameters:
      path - file path
      Returns:
      the file stat
      Throws:
      IOException - thrown if there is an IO error while obtaining the file stat
    • mmap

      public static long mmap(FileDescriptor fd, int prot, boolean shared, long length) throws IOException
      Throws:
      IOException
    • munmap

      public static void munmap(long addr, long length) throws IOException
      Throws:
      IOException