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

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

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

POSIX.waitpid介绍

暂无

代码示例

代码示例来源:origin: com.github.jnr/jnr-process

public long waitFor() {
  // TODO: This needs to handle multiple callers. Error? Block? waitpid can only be called once!
  // TODO: This needs macro handling to parse out various exit result values
  if (exitValue != -1) {
    return exitValue;
  }
  int[] status = new int[1];
  int ret = posix.waitpid(pid, status, 0);
  exitValue = status[0];
  return exitValue;
}

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

public static void syswait(Ruby runtime, int pid) {
  int[] status = {0};
  runtime.getPosix().waitpid(pid, status, 0);
}

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

public static void syswait(Ruby runtime, int pid) {
  int[] status = {0};
  runtime.getPosix().waitpid(pid, status, 0);
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

public int waitpid(long pid, int[] status, int flags) {
  return posix().waitpid(pid, status, flags);
}

代码示例来源:origin: com.github.jnr/jnr-posix

public int waitpid(long pid, int[] status, int flags) {
  try { return posix.waitpid(pid, status, flags); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}

代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep

public int waitpid(int pid, int[] status, int flags) {
  return posix().waitpid(pid, status, flags);
}

代码示例来源:origin: com.github.jnr/jnr-posix

public int waitpid(long pid, int[] status, int flags) {
  return posix().waitpid(pid, status, flags);
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

public int waitpid(long pid, int[] status, int flags) {
  try { return posix.waitpid(pid, status, flags); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

public int waitpid(long pid, int[] status, int flags) {
  try { return posix.waitpid(pid, status, flags); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

public int waitpid(long pid, int[] status, int flags) {
  return posix().waitpid(pid, status, flags);
}

代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep

public int waitpid(int pid, int[] status, int flags) {
  try { return posix.waitpid(pid, status, flags); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}

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

@Override
  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 RubyStatus.newProcessStatus(runtime, status[0], pid);
  }
};

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

@Override
  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 RubyStatus.newProcessStatus(runtime, status[0], pid);
  }
};

代码示例来源: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.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: org.python/jython

@Hide(posixImpl = PosixImpl.JAVA)
public static PyObject waitpid(int pid, int options) {
  int[] status = new int[1];
  pid = posix.waitpid(pid, status, options);
  if (pid < 0) {
    throw errorFromErrno();
  }
  return new PyTuple(Py.newInteger(pid), Py.newInteger(status[0]));
}

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

public static IRubyObject waitpid2(Ruby runtime, IRubyObject[] args) {
  int pid = -1;
  int flags = 0;
  if (args.length > 0) {
    pid = (int)args[0].convertToInteger().getLongValue();
  }
  if (args.length > 1) {
    flags = (int)args[1].convertToInteger().getLongValue();
  }
  
  int[] status = new int[1];
  pid = checkErrno(runtime, runtime.getPosix().waitpid(pid, status, flags), ECHILD);
  
  return runtime.newArray(runtime.newFixnum(pid), RubyProcess.RubyStatus.newProcessStatus(runtime, (status[0] >> 8) & 0xff, pid));
}

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

public static IRubyObject waitpid2(Ruby runtime, IRubyObject[] args) {
  int pid = -1;
  int flags = 0;
  if (args.length > 0) {
    pid = (int)args[0].convertToInteger().getLongValue();
  }
  if (args.length > 1) {
    flags = (int)args[1].convertToInteger().getLongValue();
  }
  
  int[] status = new int[1];
  pid = checkErrno(runtime, runtime.getPosix().waitpid(pid, status, flags), ECHILD);
  
  return runtime.newArray(runtime.newFixnum(pid), RubyProcess.RubyStatus.newProcessStatus(runtime, (status[0] >> 8) & 0xff, pid));
}

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

public static long waitpid(Ruby runtime, long pid, int flags) {
  int[] status = new int[1];
  runtime.getPosix().errno(0);
  pid = runtime.getPosix().waitpid(pid, status, flags);
  raiseErrnoIfSet(runtime, ECHILD);
  if (pid > 0) {
    runtime.getCurrentContext().setLastExitStatus(RubyProcess.RubyStatus.newProcessStatus(runtime, status[0], pid));
  }
  else {
    runtime.getCurrentContext().setLastExitStatus(runtime.getNil());
  }
  return pid;
}

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

public static long waitpid(Ruby runtime, long pid, int flags) {
  int[] status = new int[1];
  runtime.getPosix().errno(0);
  pid = runtime.getPosix().waitpid(pid, status, flags);
  raiseErrnoIfSet(runtime, ECHILD);
  if (pid > 0) {
    runtime.getCurrentContext().setLastExitStatus(RubyProcess.RubyStatus.newProcessStatus(runtime, status[0], pid));
  }
  else {
    runtime.getCurrentContext().setLastExitStatus(runtime.getNil());
  }
  return pid;
}

相关文章

POSIX类方法