public RaiseException newErrnoFromInt(int errno, String methodName, String message) { if (Platform.IS_WINDOWS && ("stat".equals(methodName) || "lstat".equals(methodName))) { if (errno == 20047) return newErrnoENOENTError(message); // boo:bar UNC stat failure if (errno == Errno.ESRCH.intValue()) return newErrnoENOENTError(message); // ESRCH on stating "" } return newErrnoFromInt(errno, message); }
public RaiseException newErrnoFromErrno(Errno errno, String message) { if (errno == null || errno == Errno.__UNKNOWN_CONSTANT__) { return newSystemCallError(message); } return newErrnoFromInt(errno.intValue(), message); }
public RaiseException newErrnoFromInt(int errno, String methodName, String message) { if (Platform.IS_WINDOWS && ("stat".equals(methodName) || "lstat".equals(methodName))) { if (errno == 20047) return newErrnoENOENTError(message); // boo:bar UNC stat failure if (errno == Errno.ESRCH.intValue()) return newErrnoENOENTError(message); // ESRCH on stating "" } return newErrnoFromInt(errno, message); }
public RaiseException newErrnoFromInt(int errno, String methodName, String message) { if (Platform.IS_WINDOWS && ("stat".equals(methodName) || "lstat".equals(methodName))) { if (errno == 20047) return newErrnoENOENTError(message); // boo:bar UNC stat failure if (errno == Errno.ESRCH.intValue()) return newErrnoENOENTError(message); // ESRCH on stating "" } return newErrnoFromInt(errno, message); }
private void setup(String filename, boolean lstat) { Ruby runtime = getRuntime(); if (Platform.IS_WINDOWS && filename.length() == 2 && filename.charAt(1) == ':' && Character.isLetter(filename.charAt(0))) { filename += '/'; } file = JRubyFile.createResource(runtime, filename); stat = lstat ? file.lstat() : file.stat(); if (stat == null) throw runtime.newErrnoFromInt(file.errno(), filename); }
private void setup(String filename, boolean lstat) { Ruby runtime = getRuntime(); if (Platform.IS_WINDOWS && filename.length() == 2 && filename.charAt(1) == ':' && Character.isLetter(filename.charAt(0))) { filename += '/'; } file = JRubyFile.createResource(runtime, filename); stat = lstat ? file.lstat() : file.stat(); if (stat == null) throw runtime.newErrnoFromInt(file.errno(), filename); }
public RaiseException newErrnoFromInt(int errno) { Errno errnoObj = Errno.valueOf(errno); if (errnoObj == null) { return newSystemCallError("Unknown Error (" + errno + ")"); } String message = errnoObj.description(); return newErrnoFromInt(errno, message); }
public RaiseException newErrnoFromInt(int errno) { Errno errnoObj = Errno.valueOf(errno); if (errnoObj == null) { return newSystemCallError("Unknown Error (" + errno + ")"); } String message = errnoObj.description(); return newErrnoFromInt(errno, message); }
public RaiseException newErrnoFromInt(int errno) { Errno errnoObj = Errno.valueOf(errno); if (errnoObj == null) { return newSystemCallError("Unknown Error (" + errno + ")"); } String message = errnoObj.description(); return newErrnoFromInt(errno, message); }
public RaiseException newErrnoFromInt(int errno) { Errno errnoObj = Errno.valueOf(errno); if (errnoObj == null) { return newSystemCallError("Unknown Error (" + errno + ")"); } String message = errnoObj.description(); return newErrnoFromInt(errno, message); }
private static void raiseErrnoIfSet(Ruby runtime, NonNativeErrno nonNative) { if (runtime.getPosix().errno() != 0) { throw runtime.newErrnoFromInt(runtime.getPosix().errno()); } }
protected static void rb_sys_fail(Ruby runtime, String message) { final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime()); RubyClass instance = runtime.getErrno(n); if(instance == null) { throw runtime.newSystemCallError(message); } else { throw runtime.newErrnoFromInt(n, message); } }
protected static void rb_sys_fail(Ruby runtime, String message) { final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime()); RubyClass instance = runtime.getErrno(n); if(instance == null) { throw runtime.newSystemCallError(message); } else { throw runtime.newErrnoFromInt(n, message); } }
protected static void rb_sys_fail(Ruby runtime, String message) { final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime()); RubyClass instance = runtime.getErrno(n); if(instance == null) { throw runtime.newSystemCallError(message); } else { throw runtime.newErrnoFromInt(n, message); } }
private static void raiseErrnoIfSet(Ruby runtime, NonNativeErrno nonNative) { if (runtime.getPosix().errno() != 0) { throw runtime.newErrnoFromInt(runtime.getPosix().errno()); } } }
private static void raiseErrnoIfSet(Ruby runtime, NonNativeErrno nonNative) { if (runtime.getPosix().errno() != 0) { throw runtime.newErrnoFromInt(runtime.getPosix().errno()); } } }
protected static void rb_sys_fail(Ruby runtime, String message) { final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime()); RubyClass instance = runtime.getErrno(n); if(instance == null) { throw runtime.newSystemCallError(message); } else { throw runtime.newErrnoFromInt(n, message); } }
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); }
@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; }
@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; }