io-wait 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 630936f8af6e2cf9265ebff0794cab1daf10048933460b71306486aecb92a85a
4
- data.tar.gz: 153bc0301fdb8fce6f4983d45879364509bb6534a81775d98e5f61b5ffe1923e
3
+ metadata.gz: ab2e90fe2ac7d5df2d629e3ccd501b8c01570fadd3eeee5d42709e55deb26ec6
4
+ data.tar.gz: 12663accc0c74fb25368e47a87fbc7a5b4f06ccd7435ee1ab4528e51b4dca843
5
5
  SHA512:
6
- metadata.gz: 07e0a9997d9e8dd84368feb0fdcd681282d7c583aea8d03d90abf031d6474224aa7a6f61050de11a03750cc0e20ba5759ac4eca28aae07891a778ef82cef24c6
7
- data.tar.gz: 7294e823b4536cded39faead19916b437e4a8a4d398e35917c81e84d4618d5f99bd414aa9f6989cfad4bfb8bf0721fb7934b083a72576a7e95a60d7fcf35e853
6
+ metadata.gz: 1bc887d4119a7c39978294b99d6bc2affbc0124236ec4062fe439ffbfa64db295ec4de180a1db16ad2c481927a72f046def66e34dae9cca49157ccd25a8b82e4
7
+ data.tar.gz: 1b237ca1a3f74ff1208059f49061df665ff4a78f8da89d9b7ffbb9a57cd9205ffbb848fb583704fafad66954df7f2481d9a145e1d68591c31d11ab8fff1b2dbe
data/Gemfile CHANGED
@@ -7,5 +7,6 @@ group :development do
7
7
  gem "rake"
8
8
  gem "rake-compiler"
9
9
  gem "test-unit"
10
+ gem "test-unit-ruby-core"
10
11
  gem 'ruby-maven', :platforms => :jruby
11
12
  end
@@ -6,6 +6,7 @@ if RUBY_VERSION < "2.6"
6
6
  else
7
7
  target = "io/wait"
8
8
  have_func("rb_io_wait")
9
+ have_func("rb_io_descriptor")
9
10
  unless macro_defined?("DOSISH", "#include <ruby.h>")
10
11
  have_header(ioctl_h = "sys/ioctl.h") or ioctl_h = nil
11
12
  fionread = %w[sys/ioctl.h sys/filio.h sys/socket.h].find do |h|
data/ext/io/wait/wait.c CHANGED
@@ -87,8 +87,15 @@ io_nread(VALUE io)
87
87
  rb_io_check_readable(fptr);
88
88
  len = rb_io_read_pending(fptr);
89
89
  if (len > 0) return INT2FIX(len);
90
- if (!FIONREAD_POSSIBLE_P(fptr->fd)) return INT2FIX(0);
91
- if (ioctl(fptr->fd, FIONREAD, &n)) return INT2FIX(0);
90
+
91
+ #ifdef HAVE_RB_IO_DESCRIPTOR
92
+ int fd = rb_io_descriptor(io);
93
+ #else
94
+ int fd = fptr->fd;
95
+ #endif
96
+
97
+ if (!FIONREAD_POSSIBLE_P(fd)) return INT2FIX(0);
98
+ if (ioctl(fd, FIONREAD, &n)) return INT2FIX(0);
92
99
  if (n > 0) return ioctl_arg2num(n);
93
100
  return INT2FIX(0);
94
101
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: io-wait
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nobu Nakada
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-12-16 00:00:00.000000000 Z
12
+ date: 2023-12-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Waits until IO is readable or writable without blocking.
15
15
  email:
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  requirements: []
51
- rubygems_version: 3.4.0.dev
51
+ rubygems_version: 3.5.0.dev
52
52
  signing_key:
53
53
  specification_version: 4
54
54
  summary: Waits until IO is readable or writable without blocking.