Package org.jruby.util.io
Class PosixShim
java.lang.Object
org.jruby.util.io.PosixShim
Representations of as many native posix functions as possible applied to an NIO channel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionThe recommended error message, if any.The last Throwable exception raised by a call.static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final PosixShim.WaitMacros -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintintintfcntlGetFD(int fd) intfcntlSetFD(int fd, int flags) intintjnr.constants.platform.ErrnogetErrno()The appropriate errno value for the last thrown error, if any.longopen(String cwd, String path, ModeFlags flags, int perm, ClassLoader classLoader) Deprecated.Channel[]pipe()intintread(ChannelFD fd, ByteBuffer buffer, int offset, int length, boolean nonblock) intsetCloexec(int fd, boolean cloexec) voidsetErrno(jnr.constants.platform.Errno errno) longstatic intumask(jnr.posix.POSIX posix) Joy of POSIX, only way to get the umask is to set the umask, then set it back.static intumask(jnr.posix.POSIX posix, int newMask) intintwrite(ChannelFD fd, ByteBuffer buffer, int offset, int length, boolean nonblock)
-
Field Details
-
LOCK_SH
public static final int LOCK_SH- See Also:
-
LOCK_EX
public static final int LOCK_EX- See Also:
-
LOCK_NB
public static final int LOCK_NB- See Also:
-
LOCK_UN
public static final int LOCK_UN- See Also:
-
SEEK_SET
public static final int SEEK_SET- See Also:
-
SEEK_CUR
public static final int SEEK_CUR- See Also:
-
SEEK_END
public static final int SEEK_END- See Also:
-
WAIT_MACROS
-
error
The last Throwable exception raised by a call. -
errmsg
The recommended error message, if any.
-
-
Constructor Details
-
PosixShim
-
-
Method Details
-
lseek
-
write
-
write
-
read
-
read
-
flock
-
dup2
-
close
-
close
-
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
-
open
-
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
-
size
-