sleepy_penguin 3.4.1 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.document +1 -0
  3. data/.olddoc.yml +3 -4
  4. data/GIT-VERSION-GEN +1 -1
  5. data/LICENSE +3 -3
  6. data/README +7 -4
  7. data/TODO +1 -0
  8. data/ext/sleepy_penguin/cfr.c +62 -0
  9. data/ext/sleepy_penguin/epoll.c +34 -24
  10. data/ext/sleepy_penguin/eventfd.c +6 -5
  11. data/ext/sleepy_penguin/extconf.rb +6 -0
  12. data/ext/sleepy_penguin/init.c +83 -12
  13. data/ext/sleepy_penguin/inotify.c +48 -36
  14. data/ext/sleepy_penguin/kqueue.c +22 -21
  15. data/ext/sleepy_penguin/sendfile.c +120 -0
  16. data/ext/sleepy_penguin/sleepy_penguin.h +15 -28
  17. data/ext/sleepy_penguin/sp_copy.h +33 -0
  18. data/ext/sleepy_penguin/splice.c +174 -0
  19. data/ext/sleepy_penguin/timerfd.c +1 -5
  20. data/ext/sleepy_penguin/util.c +12 -0
  21. data/lib/sleepy_penguin.rb +28 -0
  22. data/lib/sleepy_penguin/cfr.rb +29 -0
  23. data/lib/sleepy_penguin/epoll.rb +13 -10
  24. data/lib/sleepy_penguin/kqueue.rb +6 -6
  25. data/lib/sleepy_penguin/sp.rb +1 -1
  26. data/lib/sleepy_penguin/splice.rb +125 -0
  27. data/pkg.mk +5 -12
  28. data/sleepy_penguin.gemspec +13 -15
  29. data/test/helper.rb +2 -7
  30. data/test/test_cfr.rb +35 -0
  31. data/test/test_constants.rb +2 -4
  32. data/test/test_epoll.rb +35 -6
  33. data/test/test_epoll_gc.rb +2 -5
  34. data/test/test_epoll_io.rb +3 -6
  35. data/test/test_epoll_optimizations.rb +2 -2
  36. data/test/test_eventfd.rb +2 -5
  37. data/test/test_inotify.rb +2 -4
  38. data/test/test_kqueue.rb +35 -7
  39. data/test/test_kqueue_io.rb +2 -5
  40. data/test/test_pipesize.rb +22 -0
  41. data/test/test_sendfile.rb +26 -0
  42. data/test/test_splice.rb +250 -0
  43. data/test/test_splice_eintr.rb +31 -0
  44. data/test/test_timerfd.rb +2 -5
  45. metadata +27 -34
  46. data/lib/sleepy_penguin/epoll/io.rb +0 -28
  47. data/lib/sleepy_penguin/kqueue/io.rb +0 -30
@@ -0,0 +1,31 @@
1
+ # -*- encoding: binary -*-
2
+ require_relative 'helper'
3
+ require 'tempfile'
4
+ require 'socket'
5
+ require 'timeout'
6
+
7
+ class Test_Splice_EINTR < Test::Unit::TestCase
8
+ def setup
9
+ @usr1 = 0
10
+ trap(:USR1) { @usr1 += 1 }
11
+ end
12
+
13
+ def teardown
14
+ trap(:USR1, "DEFAULT")
15
+ end
16
+
17
+ def test_EINTR_splice_read
18
+ rd, wr = IO.pipe
19
+ tmp = Tempfile.new 'splice-read'
20
+ main = Thread.current
21
+ Thread.new do
22
+ sleep 0.01
23
+ Process.kill(:USR1, $$)
24
+ sleep 0.01
25
+ wr.write "HI"
26
+ end
27
+ nr = SleepyPenguin.splice rd, tmp, 666
28
+ assert_equal 2, nr
29
+ assert_equal 1, @usr1
30
+ end
31
+ end if SleepyPenguin.respond_to?(:splice)
@@ -1,10 +1,7 @@
1
- require './test/helper'
1
+ require_relative 'helper'
2
2
  require 'fcntl'
3
- $-w = true
4
3
 
5
- require 'sleepy_penguin'
6
-
7
- class TestTimerFD < Testcase
4
+ class TestTimerFD < Test::Unit::TestCase
8
5
  include SleepyPenguin
9
6
 
10
7
  def test_constants
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sleepy_penguin
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.1
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sleepy_penguin hackers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-11 00:00:00.000000000 Z
11
+ date: 2017-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: minitest
14
+ name: test-unit
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '3.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.0'
27
- - !ruby/object:Gem::Dependency
28
- name: olddoc
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.0'
26
+ version: '3.0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: strace_me
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -56,7 +42,7 @@ description: |-
56
42
  sleepy_penguin provides access to newer, Linux-only system calls to wait
57
43
  on events from traditionally non-I/O sources. Bindings to the eventfd,
58
44
  timerfd, inotify, and epoll interfaces are provided. Experimental support
59
- for kqueue on FreeBSD (and likely OpenBSD/NetBSD) are also provided.
45
+ for kqueue on FreeBSD (and likely OpenBSD/NetBSD) is also provided.
60
46
  email: sleepy-penguin@bogomips.org
61
47
  executables: []
62
48
  extensions:
@@ -66,20 +52,13 @@ extra_rdoc_files:
66
52
  - README
67
53
  - TODO
68
54
  - NEWS
69
- - lib/sleepy_penguin.rb
70
- - lib/sleepy_penguin/epoll.rb
71
- - lib/sleepy_penguin/epoll/io.rb
72
- - lib/sleepy_penguin/kevent.rb
73
- - lib/sleepy_penguin/kqueue.rb
74
- - lib/sleepy_penguin/kqueue/io.rb
75
- - lib/sleepy_penguin/signalfd/sig_info.rb
76
- - lib/sleepy_penguin/sp.rb
77
55
  - ext/sleepy_penguin/epoll.c
78
56
  - ext/sleepy_penguin/eventfd.c
79
57
  - ext/sleepy_penguin/init.c
80
58
  - ext/sleepy_penguin/inotify.c
81
59
  - ext/sleepy_penguin/timerfd.c
82
60
  - ext/sleepy_penguin/kqueue.c
61
+ - ext/sleepy_penguin/splice.c
83
62
  files:
84
63
  - ".document"
85
64
  - ".gitignore"
@@ -94,6 +73,7 @@ files:
94
73
  - NEWS
95
74
  - README
96
75
  - TODO
76
+ - ext/sleepy_penguin/cfr.c
97
77
  - ext/sleepy_penguin/epoll.c
98
78
  - ext/sleepy_penguin/eventfd.c
99
79
  - ext/sleepy_penguin/extconf.rb
@@ -106,22 +86,26 @@ files:
106
86
  - ext/sleepy_penguin/missing_inotify.h
107
87
  - ext/sleepy_penguin/missing_rb_thread_fd_close.h
108
88
  - ext/sleepy_penguin/missing_rb_update_max_fd.h
89
+ - ext/sleepy_penguin/sendfile.c
109
90
  - ext/sleepy_penguin/sleepy_penguin.h
91
+ - ext/sleepy_penguin/sp_copy.h
92
+ - ext/sleepy_penguin/splice.c
110
93
  - ext/sleepy_penguin/timerfd.c
111
94
  - ext/sleepy_penguin/util.c
112
95
  - ext/sleepy_penguin/value2timespec.h
113
96
  - lib/sleepy_penguin.rb
97
+ - lib/sleepy_penguin/cfr.rb
114
98
  - lib/sleepy_penguin/epoll.rb
115
- - lib/sleepy_penguin/epoll/io.rb
116
99
  - lib/sleepy_penguin/kevent.rb
117
100
  - lib/sleepy_penguin/kqueue.rb
118
- - lib/sleepy_penguin/kqueue/io.rb
119
101
  - lib/sleepy_penguin/signalfd/sig_info.rb
120
102
  - lib/sleepy_penguin/sp.rb
103
+ - lib/sleepy_penguin/splice.rb
121
104
  - pkg.mk
122
105
  - setup.rb
123
106
  - sleepy_penguin.gemspec
124
107
  - test/helper.rb
108
+ - test/test_cfr.rb
125
109
  - test/test_constants.rb
126
110
  - test/test_epoll.rb
127
111
  - test/test_epoll_gc.rb
@@ -131,10 +115,14 @@ files:
131
115
  - test/test_inotify.rb
132
116
  - test/test_kqueue.rb
133
117
  - test/test_kqueue_io.rb
118
+ - test/test_pipesize.rb
119
+ - test/test_sendfile.rb
120
+ - test/test_splice.rb
121
+ - test/test_splice_eintr.rb
134
122
  - test/test_timerfd.rb
135
- homepage: http://bogomips.org/sleepy_penguin/
123
+ homepage: https://bogomips.org/sleepy_penguin/
136
124
  licenses:
137
- - LGPLv2.1+
125
+ - LGPL-2.1+
138
126
  metadata: {}
139
127
  post_install_message:
140
128
  rdoc_options: []
@@ -144,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
132
  requirements:
145
133
  - - ">="
146
134
  - !ruby/object:Gem::Version
147
- version: '0'
135
+ version: '2.0'
148
136
  required_rubygems_version: !ruby/object:Gem::Requirement
149
137
  requirements:
150
138
  - - ">="
@@ -152,18 +140,23 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
140
  version: '0'
153
141
  requirements: []
154
142
  rubyforge_project:
155
- rubygems_version: 2.4.5
143
+ rubygems_version: 2.6.10
156
144
  signing_key:
157
145
  specification_version: 4
158
146
  summary: Linux I/O events for Ruby
159
147
  test_files:
148
+ - test/test_splice.rb
160
149
  - test/test_epoll_optimizations.rb
161
150
  - test/test_constants.rb
162
151
  - test/test_epoll.rb
152
+ - test/test_splice_eintr.rb
153
+ - test/test_pipesize.rb
163
154
  - test/test_kqueue_io.rb
164
155
  - test/test_inotify.rb
165
156
  - test/test_kqueue.rb
166
157
  - test/test_eventfd.rb
167
158
  - test/test_epoll_gc.rb
168
159
  - test/test_epoll_io.rb
160
+ - test/test_sendfile.rb
161
+ - test/test_cfr.rb
169
162
  - test/test_timerfd.rb
@@ -1,28 +0,0 @@
1
- class SleepyPenguin::Epoll::IO
2
- # :stopdoc:
3
- alias __epoll_wait epoll_wait
4
- undef_method :epoll_wait
5
- def epoll_wait(maxevents = 64, timeout = nil)
6
- begin
7
- if timeout == nil || timeout < 0 # wait forever
8
- begin
9
- IO.select([self])
10
- n = __epoll_wait(maxevents, 0) { |events,io| yield(events, io) }
11
- end while n == 0
12
- elsif timeout == 0
13
- return __epoll_wait(maxevents, 0) { |events,io| yield(events, io) }
14
- else
15
- done = Time.now + (timeout / 1000.0)
16
- begin
17
- tout = done - Time.now
18
- IO.select([self], nil, nil, tout) if tout > 0
19
- n = __epoll_wait(maxevents, 0) { |events,io| yield(events, io) }
20
- end while n == 0 && tout > 0
21
- end
22
- n
23
- rescue Errno::EINTR
24
- retry
25
- end
26
- end
27
- # :startdoc:
28
- end
@@ -1,30 +0,0 @@
1
- class SleepyPenguin::Kqueue::IO
2
- # :stopdoc:
3
- # this file is only for Ruby 1.8 green threads compatibility
4
- alias __kevent kevent
5
- undef_method :kevent
6
-
7
- def __update_timeout(expire_at)
8
- now = Time.now
9
- diff = expire_at - now
10
- diff > 0 ? diff : 0
11
- end
12
-
13
- def kevent(changelist = nil, nevents = nil, timeout = nil)
14
- if block_given?
15
- expire_at = timeout ? Time.now + timeout : nil
16
- begin
17
- IO.select([self], nil, nil, timeout)
18
- n = __kevent(changelist, nevents, 0) do |*args|
19
- yield(*args)
20
- end
21
- end while n == 0 && timeout != 0 &&
22
- (expire_at == nil || timeout = __update_timeout(expire_at))
23
- n
24
- else
25
- # nevents should be zero or nil here
26
- __kevent(changelist, nevents, 0)
27
- end
28
- end
29
- # :startdoc:
30
- end