dtas 0.17.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/Documentation/.gitignore +1 -1
  4. data/Documentation/GNUmakefile +1 -1
  5. data/Documentation/dtas-archive.pod +1 -1
  6. data/Documentation/dtas-console.pod +1 -1
  7. data/Documentation/dtas-ctl.pod +1 -1
  8. data/Documentation/dtas-cueedit.pod +1 -1
  9. data/Documentation/dtas-enq.pod +1 -1
  10. data/Documentation/dtas-env.pod +1 -1
  11. data/Documentation/dtas-msinkctl.pod +1 -1
  12. data/Documentation/dtas-player.pod +1 -1
  13. data/Documentation/dtas-player_effects.pod +1 -1
  14. data/Documentation/dtas-player_protocol.pod +1 -1
  15. data/Documentation/dtas-player_sink_examples.pod +1 -1
  16. data/Documentation/dtas-sinkedit.pod +2 -2
  17. data/Documentation/dtas-sourceedit.pod +2 -2
  18. data/Documentation/dtas-splitfx.pod +1 -1
  19. data/Documentation/dtas-tl.pod +1 -1
  20. data/Documentation/dtas-xdelay.pod +1 -1
  21. data/Documentation/update-footer.rb +1 -1
  22. data/GIT-VERSION-GEN +2 -2
  23. data/GNUmakefile +1 -1
  24. data/HACKING +1 -1
  25. data/INSTALL +9 -19
  26. data/README +6 -5
  27. data/Rakefile +1 -1
  28. data/TODO +1 -1
  29. data/bin/dtas-archive +1 -1
  30. data/bin/dtas-console +1 -1
  31. data/bin/dtas-ctl +1 -1
  32. data/bin/dtas-cueedit +1 -1
  33. data/bin/dtas-enq +1 -1
  34. data/bin/dtas-mlib +1 -1
  35. data/bin/dtas-msinkctl +1 -1
  36. data/bin/dtas-partstats +1 -1
  37. data/bin/dtas-player +1 -1
  38. data/bin/dtas-readahead +1 -1
  39. data/bin/dtas-sinkedit +1 -1
  40. data/bin/dtas-sourceedit +1 -1
  41. data/bin/dtas-splitfx +1 -1
  42. data/bin/dtas-tl +1 -1
  43. data/bin/dtas-xdelay +1 -1
  44. data/dtas-linux.gemspec +1 -1
  45. data/dtas-mpris.gemspec +1 -1
  46. data/dtas.gemspec +1 -1
  47. data/lib/dtas.rb +9 -1
  48. data/lib/dtas/buffer.rb +10 -7
  49. data/lib/dtas/buffer/fiddle_splice.rb +216 -0
  50. data/lib/dtas/buffer/read_write.rb +3 -3
  51. data/lib/dtas/buffer/splice.rb +3 -1
  52. data/lib/dtas/command.rb +1 -1
  53. data/lib/dtas/compat_onenine.rb +1 -1
  54. data/lib/dtas/cue_index.rb +1 -1
  55. data/lib/dtas/disclaimer.rb +1 -1
  56. data/lib/dtas/edit_client.rb +1 -1
  57. data/lib/dtas/encoding.rb +1 -1
  58. data/lib/dtas/fadefx.rb +1 -1
  59. data/lib/dtas/format.rb +1 -1
  60. data/lib/dtas/mcache.rb +1 -1
  61. data/lib/dtas/mlib.rb +1 -1
  62. data/lib/dtas/mlib/migrations/0001_initial.rb +1 -1
  63. data/lib/dtas/nonblock.rb +1 -1
  64. data/lib/dtas/parse_freq.rb +1 -1
  65. data/lib/dtas/parse_time.rb +1 -1
  66. data/lib/dtas/partstats.rb +1 -1
  67. data/lib/dtas/pipe.rb +13 -9
  68. data/lib/dtas/pipeline.rb +1 -1
  69. data/lib/dtas/player.rb +1 -1
  70. data/lib/dtas/player/client_handler.rb +1 -1
  71. data/lib/dtas/process.rb +1 -1
  72. data/lib/dtas/replaygain.rb +1 -1
  73. data/lib/dtas/rg_state.rb +1 -1
  74. data/lib/dtas/serialize.rb +1 -1
  75. data/lib/dtas/sigevent.rb +6 -3
  76. data/lib/dtas/sigevent/efd.rb +3 -1
  77. data/lib/dtas/sigevent/fiddle_efd.rb +38 -0
  78. data/lib/dtas/sigevent/pipe.rb +2 -2
  79. data/lib/dtas/sink.rb +1 -1
  80. data/lib/dtas/source.rb +1 -1
  81. data/lib/dtas/source/av.rb +1 -1
  82. data/lib/dtas/source/av_ff_common.rb +1 -1
  83. data/lib/dtas/source/cmd.rb +1 -1
  84. data/lib/dtas/source/common.rb +1 -1
  85. data/lib/dtas/source/ff.rb +1 -1
  86. data/lib/dtas/source/file.rb +1 -1
  87. data/lib/dtas/source/mp3gain.rb +1 -1
  88. data/lib/dtas/source/sox.rb +1 -1
  89. data/lib/dtas/source/splitfx.rb +1 -1
  90. data/lib/dtas/spawn_fix.rb +1 -1
  91. data/lib/dtas/splitfx.rb +1 -1
  92. data/lib/dtas/state_file.rb +1 -1
  93. data/lib/dtas/tfx.rb +1 -1
  94. data/lib/dtas/track.rb +1 -1
  95. data/lib/dtas/tracklist.rb +1 -1
  96. data/lib/dtas/unix_accepted.rb +1 -1
  97. data/lib/dtas/unix_client.rb +1 -1
  98. data/lib/dtas/unix_server.rb +1 -1
  99. data/lib/dtas/util.rb +1 -1
  100. data/lib/dtas/watchable.rb +59 -58
  101. data/lib/dtas/watchable/fiddle_ino.rb +78 -0
  102. data/lib/dtas/watchable/inotify.rb +13 -0
  103. data/lib/dtas/writable_iter.rb +1 -1
  104. data/lib/dtas/xs.rb +1 -1
  105. data/perl/dtas-graph +1 -1
  106. data/setup.rb +1 -2
  107. data/test/covshow.rb +1 -1
  108. data/test/helper.rb +1 -1
  109. data/test/player_integration.rb +1 -1
  110. data/test/test_buffer.rb +6 -6
  111. data/test/test_encoding.rb +1 -1
  112. data/test/test_env.rb +1 -1
  113. data/test/test_fadefx.rb +1 -1
  114. data/test/test_format.rb +1 -1
  115. data/test/test_format_change.rb +1 -1
  116. data/test/test_mcache.rb +1 -1
  117. data/test/test_mlib.rb +1 -1
  118. data/test/test_parse_freq.rb +1 -1
  119. data/test/test_pipeline.rb +1 -1
  120. data/test/test_player.rb +1 -1
  121. data/test/test_player_client_handler.rb +1 -1
  122. data/test/test_player_integration.rb +1 -1
  123. data/test/test_process.rb +1 -1
  124. data/test/test_rg_integration.rb +1 -1
  125. data/test/test_rg_state.rb +1 -1
  126. data/test/test_sigevent.rb +20 -0
  127. data/test/test_sink.rb +1 -1
  128. data/test/test_sink_pipe_size.rb +13 -16
  129. data/test/test_sink_tee_integration.rb +1 -1
  130. data/test/test_source_av.rb +1 -1
  131. data/test/test_source_sox.rb +1 -1
  132. data/test/test_splitfx.rb +1 -1
  133. data/test/test_tfx.rb +1 -1
  134. data/test/test_tracklist.rb +1 -1
  135. data/test/test_unixserver.rb +1 -1
  136. data/test/test_util.rb +1 -1
  137. metadata +8 -3
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  USAGE = "Usage: #$0 [-x FREQ] [-l] /dev/fd/LO /dev/fd/HI DELAY [DELAY ...]"
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2019 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  #
4
4
  # this just declares dependencies to make gem installation a little easier
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-2.0+ or later <https://www.gnu.org/licenses/gpl-2.0.txt>
3
3
  # This is GPL-2.0+ instead of GPL-3.0+ because ruby-dbus is LGPL-2.1 (only)
4
4
  Gem::Specification.new do |s|
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  Gem::Specification.new do |s|
4
4
  manifest = File.read('.gem-manifest').split(/\n/)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2019 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
 
@@ -25,6 +25,14 @@ def self.null # :nodoc:
25
25
  @null ||= File.open('/dev/null', 'r+')
26
26
  end
27
27
 
28
+ @libc = nil
29
+ def self.libc
30
+ @libc ||= begin
31
+ require 'fiddle'
32
+ Fiddle.dlopen(nil)
33
+ end
34
+ end
35
+
28
36
  # String#-@ will deduplicate strings when Ruby 2.5 is released (Dec 2017)
29
37
  # https://bugs.ruby-lang.org/issues/13077
30
38
  if RUBY_VERSION.to_f >= 2.5
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2019 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require 'io/wait'
@@ -8,12 +8,15 @@
8
8
  class DTAS::Buffer # :nodoc:
9
9
  begin
10
10
  raise LoadError, "no splice with _DTAS_POSIX" if ENV["_DTAS_POSIX"]
11
- require 'sleepy_penguin' # splice is only in Linux for now...
12
- SleepyPenguin.respond_to?(:splice) or
13
- raise LoadError, 'sleepy_penguin 3.5+ required for splice', []
14
- require_relative 'buffer/splice'
15
- include DTAS::Buffer::Splice
16
- rescue LoadError
11
+ # splice is only in Linux for now
12
+ begin
13
+ require_relative 'buffer/splice'
14
+ include DTAS::Buffer::Splice
15
+ rescue LoadError
16
+ require_relative 'buffer/fiddle_splice'
17
+ include DTAS::Buffer::FiddleSplice
18
+ end
19
+ rescue LoadError, StandardError
17
20
  require_relative 'buffer/read_write'
18
21
  include DTAS::Buffer::ReadWrite
19
22
  end
@@ -0,0 +1,216 @@
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
+ # frozen_string_literal: true
4
+ require 'io/nonblock'
5
+ require 'fiddle' # require_relative caller should expect LoadError
6
+ require_relative '../../dtas'
7
+ require_relative '../pipe'
8
+
9
+ # Used by -player on Linux systems with the "splice" syscall
10
+ module DTAS::Buffer::FiddleSplice # :nodoc:
11
+ MAX_AT_ONCE = 4096 # page size in Linux
12
+ MAX_AT_ONCE_1 = 65536
13
+ F_MOVE = 1
14
+ F_NONBLOCK = 2
15
+
16
+ Splice = Fiddle::Function.new(DTAS.libc['splice'], [
17
+ Fiddle::TYPE_INT, # int fd_in,
18
+ Fiddle::TYPE_VOIDP, # loff_t *off_in
19
+ Fiddle::TYPE_INT, # int fd_out
20
+ Fiddle::TYPE_VOIDP, # loff_t *off_out
21
+ Fiddle::TYPE_SIZE_T, # size_t len
22
+ Fiddle::TYPE_INT, # unsigned int flags
23
+ ],
24
+ Fiddle::TYPE_SSIZE_T) # ssize_t
25
+
26
+ Tee = Fiddle::Function.new(DTAS.libc['tee'], [
27
+ Fiddle::TYPE_INT, # int fd_in,
28
+ Fiddle::TYPE_INT, # int fd_out
29
+ Fiddle::TYPE_SIZE_T, # size_t len
30
+ Fiddle::TYPE_INT, # unsigned int flags
31
+ ],
32
+ Fiddle::TYPE_SSIZE_T) # ssize_t
33
+
34
+ def _syserr(s, func)
35
+ raise "BUG: we should not encounter EOF on #{func}" if s == 0
36
+ case errno = Fiddle.last_error
37
+ when Errno::EAGAIN::Errno
38
+ return :EAGAIN
39
+ when Errno::EPIPE::Errno
40
+ raise Errno::EPIPE.exception
41
+ when Errno::EINTR::Errno
42
+ return nil
43
+ else
44
+ raise SystemCallError, "#{func} error: #{errno}"
45
+ end
46
+ end
47
+
48
+ def splice(src, dst, len, flags)
49
+ begin
50
+ s = Splice.call(src.fileno, nil, dst.fileno, nil, len, flags)
51
+ return s if s > 0
52
+ sym = _syserr(s, 'splice') and return sym
53
+ end while true
54
+ end
55
+
56
+ def tee(src, dst, len, flags = 0)
57
+ begin
58
+ s = Tee.call(src.fileno, dst.fileno, len, flags)
59
+ return s if s > 0
60
+ sym = _syserr(s, 'tee') and return sym
61
+ end while true
62
+ end
63
+
64
+ def buffer_size
65
+ @to_io.pipe_size
66
+ end
67
+
68
+ # nil is OK, won't reset existing pipe, either...
69
+ def buffer_size=(bytes)
70
+ @to_io.pipe_size = bytes if bytes
71
+ @buffer_size = bytes
72
+ end
73
+
74
+ # be sure to only call this with nil when all writers to @wr are done
75
+ def discard(bytes)
76
+ splice(@to_io, DTAS.null, bytes, 0)
77
+ end
78
+
79
+ def broadcast_one(targets, limit = nil)
80
+ # single output is always non-blocking
81
+ limit ||= MAX_AT_ONCE_1
82
+ s = splice(@to_io, targets[0], limit, F_MOVE|F_NONBLOCK)
83
+ if Symbol === s
84
+ targets # our one and only target blocked on write
85
+ else
86
+ @bytes_xfer += s
87
+ :wait_readable # we want to read more from @to_io soon
88
+ end
89
+ rescue Errno::EPIPE, IOError => e
90
+ __dst_error(targets[0], e)
91
+ targets.clear
92
+ nil # do not return error here, we already spewed an error message
93
+ end
94
+
95
+ def __tee_in_full(src, dst, bytes)
96
+ rv = 0
97
+ while bytes > 0
98
+ s = tee(src, dst, bytes)
99
+ bytes -= s
100
+ rv += s
101
+ end
102
+ rv
103
+ end
104
+
105
+ def __splice_in_full(src, dst, bytes, flags)
106
+ rv = 0
107
+ while bytes > 0
108
+ s = splice(src, dst, bytes, flags)
109
+ rv += s
110
+ bytes -= s
111
+ end
112
+ rv
113
+ end
114
+
115
+ # returns the largest value we teed
116
+ def __broadcast_tee(blocked, targets, chunk_size)
117
+ most_teed = 0
118
+ targets.delete_if do |dst|
119
+ begin
120
+ t = (dst.nonblock? || most_teed == 0) ?
121
+ tee(@to_io, dst, chunk_size, F_NONBLOCK) :
122
+ __tee_in_full(@to_io, dst, chunk_size)
123
+ if Integer === t
124
+ if t > most_teed
125
+ chunk_size = t if most_teed == 0
126
+ most_teed = t
127
+ end
128
+ else
129
+ blocked << dst
130
+ end
131
+ false
132
+ rescue IOError, Errno::EPIPE => e
133
+ __dst_error(dst, e)
134
+ true
135
+ end
136
+ end
137
+ most_teed
138
+ end
139
+
140
+ def broadcast_inf(targets, limit = nil)
141
+ if targets.all?(&:ready_write_optimized?)
142
+ blocked = []
143
+ elsif targets.none?(&:nonblock?)
144
+ # if all targets are blocking, don't start until they're all writable
145
+ r = IO.select(nil, targets, nil, 0) or return targets
146
+ blocked = targets - r[1]
147
+
148
+ # tell DTAS::UNIXServer#run_once to wait on the blocked targets
149
+ return blocked if blocked[0]
150
+
151
+ # all writable, yay!
152
+ else
153
+ blocked = []
154
+ end
155
+
156
+ # don't pin too much on one target
157
+ bytes = limit || MAX_AT_ONCE
158
+ last = targets.pop # we splice to the last one, tee to the rest
159
+
160
+ # this may return zero if all targets were non-blocking
161
+ most_teed = __broadcast_tee(blocked, targets, bytes)
162
+
163
+ # don't splice more than the largest amount we successfully teed
164
+ bytes = most_teed if most_teed > 0
165
+
166
+ begin
167
+ targets << last
168
+ if last.nonblock? || most_teed == 0
169
+ s = splice(@to_io, last, bytes, F_MOVE|F_NONBLOCK)
170
+ if Symbol === s
171
+ blocked << last
172
+
173
+ # we accomplished nothing!
174
+ # If _all_ writers are blocked, do not discard data,
175
+ # stay blocked on :wait_writable
176
+ return blocked if most_teed == 0
177
+
178
+ # the tees targets win, drop data intended for last
179
+ if most_teed > 0
180
+ discard(most_teed)
181
+ @bytes_xfer += most_teed
182
+ # do not watch for writability of last, last is non-blocking
183
+ return :wait_readable
184
+ end
185
+ end
186
+ else
187
+ # the blocking case is simple
188
+ s = __splice_in_full(@to_io, last, bytes, F_MOVE)
189
+ end
190
+ @bytes_xfer += s
191
+
192
+ # if we can't splice everything
193
+ # discard it so the early targets do not get repeated data
194
+ if s < bytes && most_teed > 0
195
+ discard(bytes - s)
196
+ end
197
+ :wait_readable
198
+ rescue IOError, Errno::EPIPE => e # last failed, drop it
199
+ __dst_error(last, e)
200
+ targets.pop # we're no longer a valid target
201
+
202
+ if most_teed == 0
203
+ # nothing accomplished, watch any targets
204
+ return blocked if blocked[0]
205
+ else
206
+ # some progress, discard the data we could not splice
207
+ @bytes_xfer += most_teed
208
+ discard(most_teed)
209
+ end
210
+
211
+ # stop decoding if we're completely errored out
212
+ # returning nil will trigger close
213
+ return targets[0] ? :wait_readable : nil
214
+ end
215
+ end
216
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2019 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require 'io/nonblock'
@@ -6,8 +6,8 @@
6
6
  require_relative '../pipe'
7
7
  require_relative '../nonblock'
8
8
 
9
- # compatibility code for systems lacking "splice" support via the
10
- # "sleepy_penguin" 3.5+ RubyGem. Used only by -player
9
+ # compatibility code for non-Linux systems lacking "splice" support.
10
+ # Used only by -player
11
11
  module DTAS::Buffer::ReadWrite # :nodoc:
12
12
  MAX_AT_ONCE = 512 # min PIPE_BUF value in POSIX
13
13
  attr_accessor :buffer_size
@@ -1,10 +1,12 @@
1
- # Copyright (C) 2013-2019 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require 'io/nonblock'
5
5
  require 'sleepy_penguin'
6
6
  require_relative '../../dtas'
7
7
  require_relative '../pipe'
8
+ SleepyPenguin.respond_to?(:splice) or
9
+ raise LoadError, 'sleepy_penguin 3.5+ required for splice', []
8
10
 
9
11
  # Used by -player on Linux systems with the "sleepy_penguin" RubyGem installed
10
12
  module DTAS::Buffer::Splice # :nodoc:
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative 'serialize'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
 
4
4
  # Make Ruby 1.9.3 look like Ruby 2.0.0 to us
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative '../dtas'
@@ -1,5 +1,5 @@
1
1
  # :enddoc:
2
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  DTAS_PROGNAME = File.basename($0)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require 'tempfile'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2018-2019 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2018-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative '../dtas'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative '../dtas'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2016-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  # encoding: binary
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # Copyright (C) 2015-2019 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) 2015-2020 all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2015-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
 
4
4
  Sequel.migration do
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2015-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
 
4
4
  class DTAS::Nonblock < IO # :nodoc:
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015-2016 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2015-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative '../dtas'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  require_relative '../dtas'
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: binary -*-
2
- # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  require_relative '../dtas'
@@ -1,10 +1,6 @@
1
- # Copyright (C) 2013-2019 all contributors <dtas-all@nongnu.org>
1
+ # Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
2
2
  # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
- begin
5
- require 'sleepy_penguin'
6
- rescue LoadError
7
- end
8
4
  require_relative '../dtas'
9
5
  require_relative 'writable_iter'
10
6
  require_relative 'nonblock'
@@ -14,6 +10,11 @@ class DTAS::Pipe < DTAS::Nonblock # :nodoc:
14
10
  include DTAS::WritableIter
15
11
  attr_accessor :sink
16
12
 
13
+ if RUBY_PLATFORM =~ /linux/i && File.readable?('/proc/sys/fs/pipe-max-size')
14
+ F_SETPIPE_SZ = 1031
15
+ F_GETPIPE_SZ = 1032
16
+ end
17
+
17
18
  def self.new
18
19
  _, w = rv = pipe
19
20
  w.writable_iter_init
@@ -21,13 +22,16 @@ def self.new
21
22
  end
22
23
 
23
24
  def pipe_size=(nr)
24
- defined?(SleepyPenguin::F_SETPIPE_SZ) and
25
- fcntl(SleepyPenguin::F_SETPIPE_SZ, nr)
25
+ fcntl(F_SETPIPE_SZ, nr) if defined?(F_SETPIPE_SZ)
26
+ rescue Errno::EINVAL # old kernel
27
+ rescue Errno::EPERM
28
+ # resizes fail if Linux is close to the pipe limit for the user
29
+ # or if the user does not have permissions to resize
26
30
  end
27
31
 
28
32
  def pipe_size
29
- fcntl(SleepyPenguin::F_GETPIPE_SZ)
30
- end if defined?(SleepyPenguin::F_GETPIPE_SZ)
33
+ fcntl(F_GETPIPE_SZ)
34
+ end if defined?(F_GETPIPE_SZ)
31
35
 
32
36
  # avoid syscall, we never change IO#nonblock= directly
33
37
  def nonblock?