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

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

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

POSIX.fcntl介绍

[英]fcntl(2)
[中]fcntl(2)

代码示例

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

public int fcntlGetFD(int fd) {
  int ret = posix.fcntl(fd, Fcntl.F_GETFD);
  return ret;
}

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

static int redirectCloexecDup(Ruby runtime, int oldfd)
{
  int ret = redirectDup(runtime, oldfd);
  int flags = runtime.getPosix().fcntl(ret, Fcntl.F_GETFD);
  runtime.getPosix().fcntlInt(ret, Fcntl.F_SETFD, flags | FcntlLibrary.FD_CLOEXEC);
  return ret;
}

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

static int redirectCloexecDup(Ruby runtime, int oldfd)
{
  int ret = redirectDup(runtime, oldfd);
  int flags = runtime.getPosix().fcntl(ret, Fcntl.F_GETFD);
  runtime.getPosix().fcntlInt(ret, Fcntl.F_SETFD, flags | FcntlLibrary.FD_CLOEXEC);
  return ret;
}

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

public int fcntlGetFD(int fd) {
  int ret = posix.fcntl(fd, Fcntl.F_GETFD);
  return ret;
}

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

static int redirectDup(Ruby runtime, int oldfd)
{
  // Partial impl of rb_cloexec_fcntl_dup
  int ret;
  ret = runtime.getPosix().dup(oldfd);
  int flags = runtime.getPosix().fcntl(ret, Fcntl.F_GETFD);
  runtime.getPosix().fcntlInt(ret, Fcntl.F_SETFD, flags | FcntlLibrary.FD_CLOEXEC);
  return ret;
}

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

public int fcntl(int fd, Fcntl fcntlConst, int... arg) {
  return posix().fcntl(fd, fcntlConst);
}

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

static int redirectDup(Ruby runtime, int oldfd)
{
  // Partial impl of rb_cloexec_fcntl_dup
  int ret;
  ret = runtime.getPosix().dup(oldfd);
  int flags = runtime.getPosix().fcntl(ret, Fcntl.F_GETFD);
  runtime.getPosix().fcntlInt(ret, Fcntl.F_SETFD, flags | FcntlLibrary.FD_CLOEXEC);
  return ret;
}

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

public int fcntl(int fd, Fcntl fcntlConst, int... arg) {
  return posix().fcntl(fd, fcntlConst);
}

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

public int setCloexec(int fd, boolean cloexec) {
  int ret = posix.fcntl(fd, Fcntl.F_GETFD);
  if (ret == -1) {
    errno = Errno.valueOf(posix.errno());
    return -1;
  }
  if (
      (cloexec && (ret & FcntlLibrary.FD_CLOEXEC) == FcntlLibrary.FD_CLOEXEC)
      || (!cloexec && (ret & FcntlLibrary.FD_CLOEXEC) == 0)) {
    return 0;
  }
  ret = cloexec ?
      ret | FcntlLibrary.FD_CLOEXEC :
      ret & ~FcntlLibrary.FD_CLOEXEC;
  ret = posix.fcntlInt(fd, Fcntl.F_SETFD, ret);
  if (ret == -1) errno = Errno.valueOf(posix.errno());
  return ret;
}

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

public int fcntl(int fd, Fcntl fcntlConst) {
  try { return posix.fcntl(fd, fcntlConst); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}

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

public int setCloexec(int fd, boolean cloexec) {
  int ret = posix.fcntl(fd, Fcntl.F_GETFD);
  if (ret == -1) {
    errno = Errno.valueOf(posix.errno());
    return -1;
  }
  if (
      (cloexec && (ret & FcntlLibrary.FD_CLOEXEC) == FcntlLibrary.FD_CLOEXEC)
      || (!cloexec && (ret & FcntlLibrary.FD_CLOEXEC) == 0)) {
    return 0;
  }
  ret = cloexec ?
      ret | FcntlLibrary.FD_CLOEXEC :
      ret & ~FcntlLibrary.FD_CLOEXEC;
  ret = posix.fcntlInt(fd, Fcntl.F_SETFD, ret);
  if (ret == -1) errno = Errno.valueOf(posix.errno());
  return ret;
}

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

public int fcntl(int fd, Fcntl fcntlConst) {
  return posix().fcntl(fd, fcntlConst);
}

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

public int fcntl(int fd, Fcntl fcntlConst, int... arg) {
  return posix().fcntl(fd, fcntlConst);
}

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

public int fcntl(int fd, Fcntl fcntlConst) {
  try { return posix.fcntl(fd, fcntlConst); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}

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

public int fcntl(int fd, Fcntl fcntlConst) {
  return posix().fcntl(fd, fcntlConst);
}

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

public int fcntl(int fd, Fcntl fcntlConst, int... arg) {
  try { return posix.fcntl(fd, fcntlConst); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}

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

public int fcntl(int fd, Fcntl fcntlConst) {
  return posix().fcntl(fd, fcntlConst);
}

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

public int fcntl(int fd, Fcntl fcntlConst, int... arg) {
  try { return posix.fcntl(fd, fcntlConst); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}

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

public int fcntl(int fd, Fcntl fcntlConst) {
  try { return posix.fcntl(fd, fcntlConst); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}

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

public int fcntl(int fd, Fcntl fcntlConst, int... arg) {
  try { return posix.fcntl(fd, fcntlConst); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}

相关文章

POSIX类方法