public final String toString() { return description(); } public static Fcntl valueOf(long value) {
public int fcntl(int fd, Fcntl fcntl) { return libc().fcntl(fd, fcntl.intValue()); }
public int fcntl(int fd, Fcntl fcntl, int... arg) { return libc().fcntl(fd, fcntl.intValue()); }
public int fcntlInt(int fd, Fcntl fcntl, int arg) { return libc().fcntl(fd, fcntl.intValue(), arg); }
public final String toString() { return description(); } public static Fcntl valueOf(long value) {
public int fcntl(int fd, Fcntl fcntl) { return libc().fcntl(fd, fcntl.intValue()); }
public final String toString() { return description(); } public static Fcntl valueOf(long value) {
public int fcntl(int fd, Fcntl fcntl) { return libc().fcntl(fd, fcntl.intValue()); }
public int fcntl(int fd, Fcntl fcntl, int... arg) { return libc().fcntl(fd, fcntl.intValue()); }
public int fcntlInt(int fd, Fcntl fcntl, int arg) { return libc().fcntl(fd, fcntl.intValue(), arg); }
public int fcntlInt(int fd, Fcntl fcntl, int arg) { return libc().fcntl(fd, fcntl.intValue(), arg); }
public int fcntl(int fd, Fcntl fcntl, int... arg) { return libc().fcntl(fd, fcntl.intValue()); }
public int flock(int fd, int operation) { Pointer lock = getRuntime().getMemoryManager().allocateTemporary(FLOCK_LAYOUT.size(), true); switch (operation & ~LOCK_NB) { case LOCK_SH: FLOCK_LAYOUT.l_type.set(lock, (short) Fcntl.F_RDLCK.intValue()); break; case LOCK_EX: FLOCK_LAYOUT.l_type.set(lock, (short) Fcntl.F_WRLCK.intValue()); break; case LOCK_UN: FLOCK_LAYOUT.l_type.set(lock, (short) Fcntl.F_UNLCK.intValue()); break; default: errno(EINVAL.intValue()); return -1; } FLOCK_LAYOUT.l_whence.set(lock, (short) SEEK_SET); FLOCK_LAYOUT.l_start.set(lock, 0); FLOCK_LAYOUT.l_len.set(lock, 0); return libc().fcntl(fd, (operation & LOCK_NB) != 0 ? Fcntl.F_SETLK.intValue() : Fcntl.F_SETLKW.intValue(), lock); }
long nArg = 0; if (realCmd == Fcntl.F_GETFL.intValue()) { OpenFile myOpenFile = getOpenFileChecked(); return runtime.newFixnum(myOpenFile.getMainStream().getModes().getFcntlFileFlags()); } else if (realCmd == Fcntl.F_SETFL.intValue() || realCmd == Fcntl.F_SETFD.intValue()) { if ((nArg & FcntlLibrary.FD_CLOEXEC) == FcntlLibrary.FD_CLOEXEC) { } else if (realCmd == Fcntl.F_GETFL.intValue()) { return myOpenFile.getMainStreamSafe().isBlocking() ? RubyFixnum.zero(runtime) : RubyFixnum.newFixnum(runtime, ModeFlags.NONBLOCK); } else {
long nArg = 0; if (realCmd == Fcntl.F_GETFL.intValue()) { OpenFile myOpenFile = getOpenFileChecked(); return runtime.newFixnum(myOpenFile.getMainStream().getModes().getFcntlFileFlags()); } else if (realCmd == Fcntl.F_SETFL.intValue() || realCmd == Fcntl.F_SETFD.intValue()) { if ((nArg & FcntlLibrary.FD_CLOEXEC) == FcntlLibrary.FD_CLOEXEC) { } else if (realCmd == Fcntl.F_GETFL.intValue()) { return myOpenFile.getMainStreamSafe().isBlocking() ? RubyFixnum.zero(runtime) : RubyFixnum.newFixnum(runtime, ModeFlags.NONBLOCK); } else {
long nArg = 0; if (realCmd == Fcntl.F_GETFL.intValue()) { OpenFile myOpenFile = getOpenFileChecked(); return runtime.newFixnum(OpenFile.ioFmodeOflags(myOpenFile.getMode())); } else if (realCmd == Fcntl.F_SETFD.intValue()) { if (arg != null && (nArg & FcntlLibrary.FD_CLOEXEC) == FcntlLibrary.FD_CLOEXEC) { close_on_exec_set(context, arg); throw runtime.newNotImplementedError("F_SETFD only supports FD_CLOEXEC"); } else if (realCmd == Fcntl.F_GETFD.intValue()) { return runtime.newFixnum(close_on_exec_p(context).isTrue() ? FD_CLOEXEC : 0); } else if (realCmd == Fcntl.F_SETFL.intValue()) { if ((nArg & OpenFlags.O_NONBLOCK.intValue()) != 0) { fptr.setBlocking(runtime, true); close_on_exec_set(context, context.fals); } else if (realCmd == Fcntl.F_GETFL.intValue()) { return runtime.newFixnum( (fptr.isBlocking() ? 0 : OpenFlags.O_NONBLOCK.intValue()) |
long nArg = 0; if (realCmd == Fcntl.F_GETFL.intValue()) { OpenFile myOpenFile = getOpenFileChecked(); return runtime.newFixnum(OpenFile.ioFmodeOflags(myOpenFile.getMode())); } else if (realCmd == Fcntl.F_SETFD.intValue()) { if (arg != null && (nArg & FcntlLibrary.FD_CLOEXEC) == FcntlLibrary.FD_CLOEXEC) { close_on_exec_set(context, arg); throw runtime.newNotImplementedError("F_SETFD only supports FD_CLOEXEC"); } else if (realCmd == Fcntl.F_GETFD.intValue()) { return runtime.newFixnum(close_on_exec_p(context).isTrue() ? FD_CLOEXEC : 0); } else if (realCmd == Fcntl.F_SETFL.intValue()) { if ((nArg & OpenFlags.O_NONBLOCK.intValue()) != 0) { fptr.setBlocking(runtime, true); close_on_exec_set(context, context.fals); } else if (realCmd == Fcntl.F_GETFL.intValue()) { return runtime.newFixnum( (fptr.isBlocking() ? 0 : OpenFlags.O_NONBLOCK.intValue()) |