jnr.posix.POSIX.errno()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(179)

本文整理了Java中jnr.posix.POSIX.errno()方法的一些代码示例,展示了POSIX.errno()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。POSIX.errno()方法的具体详情如下:
包路径:jnr.posix.POSIX
类名称:POSIX
方法名:errno

POSIX.errno介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-complete

private static void raiseErrnoIfSet(Ruby runtime, NonNativeErrno nonNative) {
  if (runtime.getPosix().errno() != 0) {
    throw runtime.newErrnoFromInt(runtime.getPosix().errno());
  }
}

代码示例来源:origin: org.jruby/jruby-core

private static void raiseErrnoIfSet(Ruby runtime, NonNativeErrno nonNative) {
  if (runtime.getPosix().errno() != 0) {
    throw runtime.newErrnoFromInt(runtime.getPosix().errno());
  }
}

代码示例来源:origin: org.jruby/jruby-complete

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;
}

代码示例来源:origin: org.jruby/jruby-core

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;
}

代码示例来源:origin: org.jruby/jruby-core

static ChannelFD open_func(Ruby runtime, RubyIO.Sysopen data) {
  ChannelFD ret = parentRedirectOpen(runtime, data);
  data.errno = Errno.valueOf(runtime.getPosix().errno());
  return ret;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public RaiseException newErrnoFromLastPOSIXErrno() {
  RubyClass errnoClass = getErrno(getPosix().errno());
  if (errnoClass == null) errnoClass = systemCallError;
  return newRaiseException(errnoClass, null);
}

代码示例来源:origin: org.jruby/jruby-complete

public RaiseException newErrnoFromLastPOSIXErrno() {
  RubyClass errnoClass = getErrno(getPosix().errno());
  if (errnoClass == null) errnoClass = systemCallError;
  return newRaiseException(errnoClass, null);
}

代码示例来源:origin: org.jruby/jruby-complete

static ChannelFD open_func(Ruby runtime, RubyIO.Sysopen data) {
  ChannelFD ret = parentRedirectOpen(runtime, data);
  data.errno = Errno.valueOf(runtime.getPosix().errno());
  return ret;
}

代码示例来源:origin: org.jruby/jruby-core

public RaiseException newErrnoFromLastPOSIXErrno() {
  RubyClass errnoClass = getErrno(getPosix().errno());
  if (errnoClass == null) errnoClass = systemCallError;
  return newRaiseException(errnoClass, null);
}

代码示例来源:origin: org.jruby/jruby-complete

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);
}

代码示例来源:origin: org.jruby/jruby-complete

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);
}

代码示例来源:origin: org.jruby/jruby-core

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);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

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);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

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);
}

代码示例来源:origin: org.jruby/jruby-complete

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);
}

代码示例来源:origin: org.jruby/jruby-complete

@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;
}

代码示例来源:origin: org.jruby/jruby-complete

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);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

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);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

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);
}

代码示例来源:origin: org.jruby/jruby-core

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);
}

相关文章

POSIX类方法