org.jruby.Ruby.getPosix()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(88)

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

Ruby.getPosix介绍

暂无

代码示例

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

public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block) {
    int[] status = new int[1];
    Ruby runtime = context.runtime;
    int result = checkErrno(runtime, runtime.getPosix().waitpid(pid, status, 0));
    
    return runtime.newFixnum(result);
  }
};

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

@JRubyMethod(meta = true, name = "native_posix?")
public static IRubyObject native_posix_p(ThreadContext context, IRubyObject self) {
  return context.runtime.newBoolean(context.runtime.getPosix().isNative());
}

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

@JRubyMethod(required = 1)
public IRubyObject lchmod(ThreadContext context, IRubyObject arg) {
  int mode = (int) arg.convertToInteger().getLongValue();
  if (!new File(path).exists()) {
    throw context.runtime.newErrnoENOENTError(path);
  }
  return context.runtime.newFixnum(context.runtime.getPosix().lchmod(path, mode));
}

代码示例来源: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.kill-bill.billing/killbill-osgi-bundles-jruby

public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block) {
    int[] status = new int[1];
    Ruby runtime = context.runtime;
    int result = checkErrno(runtime, runtime.getPosix().waitpid(pid, status, 0));
    
    return runtime.newFixnum(result);
  }
};

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

@JRubyMethod(required = 1)
public IRubyObject lchmod(ThreadContext context, IRubyObject arg) {
  int mode = (int) arg.convertToInteger().getLongValue();
  if (!new File(path).exists()) {
    throw context.runtime.newErrnoENOENTError(path);
  }
  return context.runtime.newFixnum(context.runtime.getPosix().lchmod(path, mode));
}

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

@JRubyMethod(rest = true, module = true, visibility = PRIVATE)
public static RubyFixnum spawn(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  Ruby runtime = context.runtime;
  if (runtime.getPosix().isNative() && !Platform.IS_WINDOWS) {
    return PopenExecutor.spawn(context, args);
  }
  return RubyFixnum.newFixnum(runtime, ShellLauncher.runExternalWithoutWait(runtime, args));
}

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

public static IRubyObject ppid(Ruby runtime) {
  int result = checkErrno(runtime, runtime.getPosix().getppid());
  return runtime.newFixnum(result);
}

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

@JRubyMethod(required = 1)
public IRubyObject chmod(ThreadContext context, IRubyObject arg) {
  checkClosed(context);
  int mode = (int) arg.convertToInteger().getLongValue();
  if (!new File(path).exists()) {
    throw context.runtime.newErrnoENOENTError(path);
  }
  return context.runtime.newFixnum(context.runtime.getPosix().chmod(path, mode));
}

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

@JRubyMethod(rest = true, module = true, visibility = PRIVATE)
public static RubyFixnum spawn(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  Ruby runtime = context.runtime;
  if (runtime.getPosix().isNative() && !Platform.IS_WINDOWS) {
    return PopenExecutor.spawn(context, args);
  }
  return RubyFixnum.newFixnum(runtime, ShellLauncher.runExternalWithoutWait(runtime, args));
}

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

public static IRubyObject gid(Ruby runtime) {
  if (Platform.IS_WINDOWS) {
    // MRI behavior on Windows
    return RubyFixnum.zero(runtime);
  }
  return runtime.newFixnum(checkErrno(runtime, runtime.getPosix().getgid()));
}

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

@JRubyMethod(required = 1)
public IRubyObject chmod(ThreadContext context, IRubyObject arg) {
  checkClosed(context);
  int mode = (int) arg.convertToInteger().getLongValue();
  if (!new File(path).exists()) {
    throw context.runtime.newErrnoENOENTError(path);
  }
  return context.runtime.newFixnum(context.runtime.getPosix().chmod(path, mode));
}

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

@JRubyMethod(name = "sticky?")
public IRubyObject sticky_p() {
  Ruby runtime = getRuntime();
  
  if (runtime.getPosix().isNative()) {
    return runtime.newBoolean(stat.isSticky());
  }
  
  return runtime.getNil();
}

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

public static IRubyObject egid(Ruby runtime) {
  if (Platform.IS_WINDOWS) {
    // MRI behavior on Windows
    return RubyFixnum.zero(runtime);
  }
  return runtime.newFixnum(checkErrno(runtime, runtime.getPosix().getegid()));
}

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

@JRubyMethod(required = 1)
public IRubyObject chmod(ThreadContext context, IRubyObject arg) {
  checkClosed(context);
  int mode = (int) arg.convertToInteger().getLongValue();
  final String path = getPath();
  if ( ! new File(path).exists() ) {
    throw context.runtime.newErrnoENOENTError(path);
  }
  return context.runtime.newFixnum(context.runtime.getPosix().chmod(path, mode));
}

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

@JRubyMethod(name = "sticky?")
public IRubyObject sticky_p() {
  checkInitialized();
  Ruby runtime = getRuntime();
  
  if (runtime.getPosix().isNative()) {
    return runtime.newBoolean(stat.isSticky());
  }
  
  return runtime.getNil();
}

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

public static IRubyObject egid(Ruby runtime) {
  if (Platform.IS_WINDOWS) {
    // MRI behavior on Windows
    return RubyFixnum.zero(runtime);
  }
  return runtime.newFixnum(checkErrno(runtime, runtime.getPosix().getegid()));
}

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

@JRubyMethod(required = 1)
public IRubyObject chmod(ThreadContext context, IRubyObject arg) {
  checkClosed(context);
  int mode = (int) arg.convertToInteger().getLongValue();
  final String path = getPath();
  if ( ! new File(path).exists() ) {
    throw context.runtime.newErrnoENOENTError(path);
  }
  return context.runtime.newFixnum(context.runtime.getPosix().chmod(path, mode));
}

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

@JRubyMethod(name = "owned?", required = 1, module = true)
public static IRubyObject owned_p(IRubyObject recv, IRubyObject filename) {
  Ruby runtime = recv.getRuntime();
  FileResource file = fileResource(filename);
  return runtime.newBoolean(file.exists() && file.stat(runtime.getPosix()).isOwned());
}

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

public static IRubyObject gid(Ruby runtime) {
  if (Platform.IS_WINDOWS) {
    // MRI behavior on Windows
    return RubyFixnum.zero(runtime);
  }
  return runtime.newFixnum(checkErrno(runtime, runtime.getPosix().getgid()));
}

相关文章

微信公众号

最新文章

更多

Ruby类方法