# -*- encoding: binary -*- require 'io_splice_ext' class IO class Splice # the version of IO::Splice, currently 0.1.0 VERSION = '0.1.0' # The maximum capacity of the pipe in bytes. # Under stock Linux, this is 65536 bytes as of 2.6.11, and 4096 before # We detect this at runtime as it is easy to recompile the kernel # and set a new value. PIPE_CAPA = begin rd, wr = IO.pipe buf = ' ' * PIPE_BUF n = 0 begin n += wr.write_nonblock(buf) rescue Errno::EAGAIN break end while true wr.close rd.close n end end end