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

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

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

POSIX.fcntlInt介绍

暂无

代码示例

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

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

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

  1. public int fcntlInt(int fd, Fcntl fcntlConst, int arg) {
  2. return posix().fcntlInt(fd, fcntlConst, arg);
  3. }

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

  1. public int fcntlInt(int fd, Fcntl fcntlConst, int arg) {
  2. return posix().fcntlInt(fd, fcntlConst, arg);
  3. }

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

  1. public int fcntlInt(int fd, Fcntl fcntlConst, int arg) {
  2. return posix().fcntlInt(fd, fcntlConst, arg);
  3. }

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

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

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

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

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

  1. public int fcntlSetFD(int fd, int flags) {
  2. int ret = posix.fcntlInt(fd, Fcntl.F_SETFD, flags);
  3. if (ret == -1) errno = Errno.valueOf(posix.errno());
  4. return ret;
  5. }

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

  1. public int fcntlSetFD(int fd, int flags) {
  2. int ret = posix.fcntlInt(fd, Fcntl.F_SETFD, flags);
  3. if (ret == -1) errno = Errno.valueOf(posix.errno());
  4. return ret;
  5. }

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

  1. static int redirectCloexecDup(Ruby runtime, int oldfd)
  2. {
  3. int ret = redirectDup(runtime, oldfd);
  4. int flags = runtime.getPosix().fcntl(ret, Fcntl.F_GETFD);
  5. runtime.getPosix().fcntlInt(ret, Fcntl.F_SETFD, flags | FcntlLibrary.FD_CLOEXEC);
  6. return ret;
  7. }

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

  1. static int redirectCloexecDup(Ruby runtime, int oldfd)
  2. {
  3. int ret = redirectDup(runtime, oldfd);
  4. int flags = runtime.getPosix().fcntl(ret, Fcntl.F_GETFD);
  5. runtime.getPosix().fcntlInt(ret, Fcntl.F_SETFD, flags | FcntlLibrary.FD_CLOEXEC);
  6. return ret;
  7. }

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

  1. static int redirectDup(Ruby runtime, int oldfd)
  2. {
  3. // Partial impl of rb_cloexec_fcntl_dup
  4. int ret;
  5. ret = runtime.getPosix().dup(oldfd);
  6. int flags = runtime.getPosix().fcntl(ret, Fcntl.F_GETFD);
  7. runtime.getPosix().fcntlInt(ret, Fcntl.F_SETFD, flags | FcntlLibrary.FD_CLOEXEC);
  8. return ret;
  9. }

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

  1. static int redirectDup(Ruby runtime, int oldfd)
  2. {
  3. // Partial impl of rb_cloexec_fcntl_dup
  4. int ret;
  5. ret = runtime.getPosix().dup(oldfd);
  6. int flags = runtime.getPosix().fcntl(ret, Fcntl.F_GETFD);
  7. runtime.getPosix().fcntlInt(ret, Fcntl.F_SETFD, flags | FcntlLibrary.FD_CLOEXEC);
  8. return ret;
  9. }

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

  1. protected static ChannelFD newChannelFD(Ruby runtime, Channel channel) {
  2. ChannelFD fd = new ChannelFD(channel, runtime.getPosix(), runtime.getFilenoUtil());
  3. if (runtime.getPosix().isNative() && fd.realFileno >= 0 && !Platform.IS_WINDOWS) {
  4. runtime.getPosix().fcntlInt(fd.realFileno, Fcntl.F_SETFD, FcntlLibrary.FD_CLOEXEC);
  5. }
  6. return fd;
  7. }

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

  1. protected static ChannelFD newChannelFD(Ruby runtime, Channel channel) {
  2. ChannelFD fd = new ChannelFD(channel, runtime.getPosix(), runtime.getFilenoUtil());
  3. if (runtime.getPosix().isNative() && fd.realFileno >= 0 && !Platform.IS_WINDOWS) {
  4. runtime.getPosix().fcntlInt(fd.realFileno, Fcntl.F_SETFD, FcntlLibrary.FD_CLOEXEC);
  5. }
  6. return fd;
  7. }

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

  1. public int setCloexec(int fd, boolean cloexec) {
  2. int ret = posix.fcntl(fd, Fcntl.F_GETFD);
  3. if (ret == -1) {
  4. errno = Errno.valueOf(posix.errno());
  5. return -1;
  6. }
  7. if (
  8. (cloexec && (ret & FcntlLibrary.FD_CLOEXEC) == FcntlLibrary.FD_CLOEXEC)
  9. || (!cloexec && (ret & FcntlLibrary.FD_CLOEXEC) == 0)) {
  10. return 0;
  11. }
  12. ret = cloexec ?
  13. ret | FcntlLibrary.FD_CLOEXEC :
  14. ret & ~FcntlLibrary.FD_CLOEXEC;
  15. ret = posix.fcntlInt(fd, Fcntl.F_SETFD, ret);
  16. if (ret == -1) errno = Errno.valueOf(posix.errno());
  17. return ret;
  18. }

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

  1. public int setCloexec(int fd, boolean cloexec) {
  2. int ret = posix.fcntl(fd, Fcntl.F_GETFD);
  3. if (ret == -1) {
  4. errno = Errno.valueOf(posix.errno());
  5. return -1;
  6. }
  7. if (
  8. (cloexec && (ret & FcntlLibrary.FD_CLOEXEC) == FcntlLibrary.FD_CLOEXEC)
  9. || (!cloexec && (ret & FcntlLibrary.FD_CLOEXEC) == 0)) {
  10. return 0;
  11. }
  12. ret = cloexec ?
  13. ret | FcntlLibrary.FD_CLOEXEC :
  14. ret & ~FcntlLibrary.FD_CLOEXEC;
  15. ret = posix.fcntlInt(fd, Fcntl.F_SETFD, ret);
  16. if (ret == -1) errno = Errno.valueOf(posix.errno());
  17. return ret;
  18. }

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

  1. if ((ret & FD_CLOEXEC) != flag) {
  2. ret = (ret & ~FD_CLOEXEC) | flag;
  3. ret = posix.fcntlInt(fd, Fcntl.F_SETFD, ret);
  4. if (ret == -1) API.rb_sys_fail_path(runtime, fptr.getPath());
  5. if ((ret & FD_CLOEXEC) != flag) {
  6. ret = (ret & ~FD_CLOEXEC) | flag;
  7. ret = posix.fcntlInt(fd, Fcntl.F_SETFD, ret);
  8. if (ret == -1) API.rb_sys_fail_path(runtime, fptr.getPath());

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

  1. if ((ret & FD_CLOEXEC) != flag) {
  2. ret = (ret & ~FD_CLOEXEC) | flag;
  3. ret = posix.fcntlInt(fd, Fcntl.F_SETFD, ret);
  4. if (ret == -1) API.rb_sys_fail_path(runtime, fptr.getPath());
  5. if ((ret & FD_CLOEXEC) != flag) {
  6. ret = (ret & ~FD_CLOEXEC) | flag;
  7. ret = posix.fcntlInt(fd, Fcntl.F_SETFD, ret);
  8. if (ret == -1) API.rb_sys_fail_path(runtime, fptr.getPath());

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

  1. int fd = posix.open(absolutePath(), modeFlags.getFlags(), perm);
  2. if (fd < 0) throwFromErrno(posix.errno());
  3. posix.fcntlInt(fd, Fcntl.F_SETFD, posix.fcntl(fd, Fcntl.F_GETFD) | FcntlLibrary.FD_CLOEXEC);
  4. return new NativeDeviceChannel(fd, true);

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

  1. int fd = posix.open(absolutePath(), modeFlags.getFlags(), perm);
  2. if (fd < 0) throwFromErrno(posix.errno());
  3. posix.fcntlInt(fd, Fcntl.F_SETFD, posix.fcntl(fd, Fcntl.F_GETFD) | FcntlLibrary.FD_CLOEXEC);
  4. return new NativeDeviceChannel(fd, true);

相关文章

POSIX类方法