public int fcntlSetFD(int fd, int flags) { int ret = posix.fcntlInt(fd, Fcntl.F_SETFD, flags); if (ret == -1) errno = Errno.valueOf(posix.errno()); return ret; }
public int fcntlSetFD(int fd, int flags) { int ret = posix.fcntlInt(fd, Fcntl.F_SETFD, flags); if (ret == -1) errno = Errno.valueOf(posix.errno()); return ret; }
static ChannelFD open_func(Ruby runtime, RubyIO.Sysopen data) { ChannelFD ret = parentRedirectOpen(runtime, data); data.errno = Errno.valueOf(runtime.getPosix().errno()); return ret; }
public RaiseException newErrnoFromLastPOSIXErrno() { RubyClass errnoClass = getErrno(getPosix().errno()); if (errnoClass == null) errnoClass = systemCallError; return newRaiseException(errnoClass, null); }
public RaiseException newErrnoFromLastPOSIXErrno() { RubyClass errnoClass = getErrno(getPosix().errno()); if (errnoClass == null) errnoClass = systemCallError; return newRaiseException(errnoClass, null); }
static ChannelFD open_func(Ruby runtime, RubyIO.Sysopen data) { ChannelFD ret = parentRedirectOpen(runtime, data); data.errno = Errno.valueOf(runtime.getPosix().errno()); return ret; }
public RaiseException newErrnoFromLastPOSIXErrno() { RubyClass errnoClass = getErrno(getPosix().errno()); if (errnoClass == null) errnoClass = systemCallError; return newRaiseException(errnoClass, null); }
public void checkTTY() { if (fd.realFileno != -1 && runtime.getPosix().isatty(fd.realFileno) != 0 || stdio_file != null) { boolean locked = lock(); try { mode |= TTY | DUPLEX; } finally { if (locked) unlock(); } } // Clear errno so ENOTTY does not get picked up elsewhere (jruby/jruby#4527 runtime.getPosix().errno(0); }
public static IRubyObject mkfifo(ThreadContext context, RubyString path, int mode) { Ruby runtime = context.runtime; String decodedPath = JRubyFile.createResource(runtime, path.toString()).absolutePath(); if (runtime.getPosix().mkfifo(decodedPath, mode) != 0) { throw runtime.newErrnoFromInt(runtime.getPosix().errno(), decodedPath); } return RubyFixnum.zero(runtime); }
public static IRubyObject mkfifo(ThreadContext context, RubyString path, int mode) { Ruby runtime = context.runtime; String decodedPath = JRubyFile.createResource(runtime, path.toString()).absolutePath(); if (runtime.getPosix().mkfifo(decodedPath, mode) != 0) { throw runtime.newErrnoFromInt(runtime.getPosix().errno(), decodedPath); } return RubyFixnum.zero(runtime); }
public static IRubyObject wait(Ruby runtime, IRubyObject[] args) { if (args.length > 0) { return waitpid(runtime, args); } int[] status = new int[1]; runtime.getPosix().errno(0); int pid = runtime.getPosix().wait(status); raiseErrnoIfSet(runtime, ECHILD); runtime.getCurrentContext().setLastExitStatus(RubyProcess.RubyStatus.newProcessStatus(runtime, (status[0] >> 8) & 0xff, pid)); return runtime.newFixnum(pid); }
public static IRubyObject wait(Ruby runtime, IRubyObject[] args) { if (args.length > 0) { return waitpid(runtime, args); } int[] status = new int[1]; runtime.getPosix().errno(0); int pid = runtime.getPosix().wait(status); raiseErrnoIfSet(runtime, ECHILD); runtime.getCurrentContext().setLastExitStatus(RubyProcess.RubyStatus.newProcessStatus(runtime, (status[0] >> 8) & 0xff, pid)); return runtime.newFixnum(pid); }
public static IRubyObject wait(Ruby runtime, IRubyObject[] args) { if (args.length > 0) { return waitpid(runtime, args); } int[] status = new int[1]; runtime.getPosix().errno(0); int pid = runtime.getPosix().wait(status); raiseErrnoIfSet(runtime, ECHILD); runtime.getCurrentContext().setLastExitStatus(RubyProcess.RubyStatus.newProcessStatus(runtime, status[0], pid)); return runtime.newFixnum(pid); }
@JRubyMethod(name = "setrlimit", module = true, visibility = PRIVATE) public static IRubyObject setrlimit(ThreadContext context, IRubyObject recv, IRubyObject resource, IRubyObject rlimCur, IRubyObject rlimMax) { Ruby runtime = context.runtime; RLimit rlim = runtime.getPosix().getrlimit(0); if (rlimMax == context.nil) rlimMax = rlimCur; rlim.init(rlimitResourceValue(runtime, rlimCur), rlimitResourceValue(runtime, rlimMax)); if (runtime.getPosix().setrlimit(rlimitResourceType(runtime, resource), rlim) < 0) { throw runtime.newErrnoFromInt(runtime.getPosix().errno(), "setrlimit"); } return context.nil; }
public static IRubyObject setpriority(Ruby runtime, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) { int which = (int)arg1.convertToInteger().getLongValue(); int who = (int)arg2.convertToInteger().getLongValue(); int prio = (int)arg3.convertToInteger().getLongValue(); runtime.getPosix().errno(0); int result = checkErrno(runtime, runtime.getPosix().setpriority(which, who, prio)); return runtime.newFixnum(result); }
public static IRubyObject setpriority(Ruby runtime, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) { int which = (int)arg1.convertToInteger().getLongValue(); int who = (int)arg2.convertToInteger().getLongValue(); int prio = (int)arg3.convertToInteger().getLongValue(); runtime.getPosix().errno(0); int result = checkErrno(runtime, runtime.getPosix().setpriority(which, who, prio)); return runtime.newFixnum(result); }
public static IRubyObject setpriority(Ruby runtime, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) { int which = (int)arg1.convertToInteger().getLongValue(); int who = (int)arg2.convertToInteger().getLongValue(); int prio = (int)arg3.convertToInteger().getLongValue(); runtime.getPosix().errno(0); int result = checkErrno(runtime, runtime.getPosix().setpriority(which, who, prio)); return runtime.newFixnum(result); }
public static IRubyObject setpriority(Ruby runtime, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) { int which = (int)arg1.convertToInteger().getLongValue(); int who = (int)arg2.convertToInteger().getLongValue(); int prio = (int)arg3.convertToInteger().getLongValue(); runtime.getPosix().errno(0); int result = checkErrno(runtime, runtime.getPosix().setpriority(which, who, prio)); return runtime.newFixnum(result); }