Class PosixShim

java.lang.Object
org.jruby.util.io.PosixShim

public class PosixShim extends Object
Representations of as many native posix functions as possible applied to an NIO channel
  • Field Details

  • Constructor Details

    • PosixShim

      public PosixShim(Ruby runtime)
  • Method Details

    • lseek

      public long lseek(ChannelFD fd, long offset, int type)
    • write

      public int write(ChannelFD fd, byte[] bytes, int offset, int length, boolean nonblock)
    • write

      public int write(ChannelFD fd, ByteBuffer buffer, int offset, int length, boolean nonblock)
    • read

      public int read(ChannelFD fd, byte[] target, int offset, int length, boolean nonblock)
    • read

      public int read(ChannelFD fd, ByteBuffer buffer, int offset, int length, boolean nonblock)
    • flock

      public int flock(ChannelFD fd, int lockMode)
    • dup2

      public int dup2(ChannelFD filedes, ChannelFD filedes2)
    • close

      public int close(ChannelFD fd)
    • close

      public int close(Closeable closeable)
    • pipe

      public Channel[] pipe()
    • getErrno

      public jnr.constants.platform.Errno getErrno()
      The appropriate errno value for the last thrown error, if any.
    • setErrno

      public void setErrno(jnr.constants.platform.Errno errno)
    • setCloexec

      public int setCloexec(int fd, boolean cloexec)
    • fcntlSetFD

      public int fcntlSetFD(int fd, int flags)
    • fcntlGetFD

      public int fcntlGetFD(int fd)
    • open

      public Channel open(String cwd, String path, int flags, int perm)
    • open

      public Channel open(String cwd, String path, ModeFlags flags, int perm)
    • open

      @Deprecated public Channel open(String cwd, String path, ModeFlags flags, int perm, ClassLoader classLoader)
      Deprecated.
    • umask

      public static int umask(jnr.posix.POSIX posix)
      Joy of POSIX, only way to get the umask is to set the umask, then set it back. That's unsafe in a threaded program. We minimize but may not totally remove this race by caching the obtained or previously set (see umask() above) umask and using that as the initial set value which, cross fingers, is a no-op. The cache access is then synchronized. TODO: Better?
    • umask

      public static int umask(jnr.posix.POSIX posix, int newMask)
    • ftruncate

      public int ftruncate(ChannelFD fd, long pos)
    • size

      public long size(ChannelFD fd)